Show / Hide Table of Contents

Class ExceptionFormatter

Implements base functions for exception formatter.

Inheritance
System.Object
ExceptionFormatter
TextExceptionFormatter
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Sartorius.SAF.ExceptionHandling
Assembly: Sartorius.SAF.dll
Syntax
public abstract class ExceptionFormatter

Properties

View Source

AdditionalInfo

Gets additional information related to the Exception but not stored in the exception (eg: the time in which the Exception was thrown).

Declaration
public NameValueCollection AdditionalInfo { get; }
Property Value
Type Description
System.Collections.Specialized.NameValueCollection

Additional information related to the Exception but not stored in the exception (for example, the time when the Exception was thrown).

View Source

Exception

Gets the exception object.

Declaration
protected Exception Exception { get; }
Property Value
Type Description
System.Exception

Methods

View Source

Format(Exception)

Formats the Exception into the underlying stream.

Declaration
public virtual string Format(Exception ex)
Parameters
Type Name Description
System.Exception ex
Returns
Type Description
System.String
View Source

WriteAdditionalInfo(NameValueCollection)

When overridden by a class, writes additional properties if available.

Declaration
protected abstract void WriteAdditionalInfo(NameValueCollection additionalInformation)
Parameters
Type Name Description
System.Collections.Specialized.NameValueCollection additionalInformation

Additional information to be included with the exception report

View Source

WriteDateTime(DateTime)

When overridden by a class, writes the current time.

Declaration
protected abstract void WriteDateTime(DateTime utcNow)
Parameters
Type Name Description
System.DateTime utcNow

The current time.

View Source

WriteDescription()

When overridden by a class, writes a description of the caught exception.

Declaration
protected abstract void WriteDescription()
View Source

WriteException(Exception, Exception)

Formats the exception and all nested inner exceptions.

Declaration
protected virtual void WriteException(Exception exceptionToFormat, Exception outerException)
Parameters
Type Name Description
System.Exception exceptionToFormat

The exception to format.

System.Exception outerException

The outer exception. This value will be null when writing the outer-most exception.

Remarks

This method calls itself recursively until it reaches an exception that does not have an inner exception.

This is a template method which calls the following methods in order

  1. WriteExceptionType(Type)
  2. WriteMessage(String)
  3. WriteSource(String)
  4. WriteHelpLink(String)
  5. WriteReflectionInfo(Exception)
  6. WriteStackTrace(String)
  7. If the specified exception has an inner exception then it makes a recursive call. WriteException(Exception, Exception)

View Source

WriteExceptionType(Type)

When overridden by a class, writes the System.Type of the current exception.

Declaration
protected abstract void WriteExceptionType(Type exceptionType)
Parameters
Type Name Description
System.Type exceptionType

The System.Type of the exception.

View Source

WriteFieldInfo(FieldInfo, Object)

When overridden by a class, writes the value of a System.Reflection.FieldInfo object.

Declaration
protected abstract void WriteFieldInfo(FieldInfo fieldInfo, object value)
Parameters
Type Name Description
System.Reflection.FieldInfo fieldInfo

The reflected System.Reflection.FieldInfo object.

System.Object value

The value of the System.Reflection.FieldInfo object.

View Source

WriteHelpLink(String)

When overridden by a class, writes the value of the System.Exception.HelpLink property.

Declaration
protected abstract void WriteHelpLink(string helpLink)
Parameters
Type Name Description
System.String helpLink

The help link for the exception.

View Source

WriteMessage(String)

When overridden by a class, writes the System.Exception.Message.

Declaration
protected abstract void WriteMessage(string message)
Parameters
Type Name Description
System.String message

The message to write.

View Source

WritePropertyInfo(PropertyInfo, Object)

When overridden by a class, writes the value of a System.Reflection.PropertyInfo object.

Declaration
protected abstract void WritePropertyInfo(PropertyInfo propertyInfo, object value)
Parameters
Type Name Description
System.Reflection.PropertyInfo propertyInfo

The reflected System.Reflection.PropertyInfo object.

System.Object value

The value of the System.Reflection.PropertyInfo object.

View Source

WriteReflectionInfo(Exception)

Formats an Exception using reflection to get the information.

Declaration
protected void WriteReflectionInfo(Exception exceptionToFormat)
Parameters
Type Name Description
System.Exception exceptionToFormat

The Exception to be formatted.

Remarks

This method reflects over the public, instance properties and public, instance fields of the specified exception and prints them to the formatter. Certain property names are ignored because they are handled explicitly in other places.

View Source

WriteSource(String)

When overridden by a class, writes the value of the System.Exception.Source property.

Declaration
protected abstract void WriteSource(string source)
Parameters
Type Name Description
System.String source

The source of the exception.

View Source

WriteStackTrace(String)

When overridden by a class, writes the value of the System.Exception.StackTrace property.

Declaration
protected abstract void WriteStackTrace(string stackTrace)
Parameters
Type Name Description
System.String stackTrace

The stack trace of the exception.

Extension Methods

CollectionExtensions.AddRange<T, TCollection>(TCollection, IEnumerable<T>)
SerializableObjectCloneExtension.Clone<T>(T)
  • View Source
Back to top Generated by DocFX