Volume Control
Application-specific hotkeys for Windows
VolumeControl.Log.Helpers.ExceptionMessageHelper Class Reference

Helper methods for converting exceptions into nicely formatted strings. More...

Collaboration diagram for VolumeControl.Log.Helpers.ExceptionMessageHelper:

Public Types

enum class  MessageParts {
  None = 0 , Message = 1 , HResult = 2 , ExceptionType = 4 ,
  HelpLink = 8 , CustomProperties = 16 , Source = 32 , TargetSite = 64 ,
  Data = 128 , StackTrace = 256 , InnerException = 512 , All = Message | HResult | ExceptionType | HelpLink | CustomProperties | Source | TargetSite | Data | StackTrace | InnerException
}
 Defines the sections in a formatted exception message string. More...
 

Static Public Member Functions

static string MakeExceptionMessage (Exception exception, string linePrefix, string endline, int tabLength, MessageParts includedParts)
 Creates a nicely-formatted exception message from the specified exception object. More...
 
static string MakeExceptionMessage (Exception exception, string linePrefix="", int tabLength=2, MessageParts includedParts=MessageParts.All)
 
static string MakeSerialExceptionMessage (Exception exception, MessageParts includedParts=MessageParts.All)
 Creates a single-line exception message from the specified exception object. More...
 

Detailed Description

Helper methods for converting exceptions into nicely formatted strings.

This is used internally by AsyncLogWriter to format exceptions.

Member Enumeration Documentation

◆ MessageParts

Defines the sections in a formatted exception message string.

Enumerator
None 

Nothing.

Message 

The Exception.Message property.

HResult 

The Exception.HResult property.

ExceptionType 

The Type of the exception object.

HelpLink 

The Exception.HelpLink property.

CustomProperties 

Properties defined in derived exception objects.

Source 

The Exception.Source property.

TargetSite 

The Exception.TargetSite property.

Data 

The Exception.Data property.

StackTrace 

The Exception.StackTrace property.

InnerException 

The Exception.InnerException property.

All 

All other values in the MessageParts enumeration.

Member Function Documentation

◆ MakeExceptionMessage()

static string VolumeControl.Log.Helpers.ExceptionMessageHelper.MakeExceptionMessage ( Exception  exception,
string  linePrefix,
string  endline,
int  tabLength,
MessageParts  includedParts 
)
static

Creates a nicely-formatted exception message from the specified exception object.

Parameters
exceptionException object to create a message for.
linePrefixstring prefix inserted before every line except for the first one.
endlinestring suffix appended to every line except for the last one.
tabLengthThe number of spaces to use for each tab character.
includedPartsValue(s) from the MessageParts enumeration that determines what is included in the message.
Returns
Psuedo-JSON formatted exception message as a string.
Exceptions
ArgumentNullExceptionexception was null.

◆ MakeSerialExceptionMessage()

static string VolumeControl.Log.Helpers.ExceptionMessageHelper.MakeSerialExceptionMessage ( Exception  exception,
MessageParts  includedParts = MessageParts.All 
)
static

Creates a single-line exception message from the specified exception object.


The documentation for this class was generated from the following file: