Class ExceptionConverter
- Namespace
- Codebelt.Extensions.YamlDotNet.Converters
- Assembly
- Codebelt.Extensions.YamlDotNet.dll
Converts an Exception to YAML.
public class ExceptionConverter : YamlConverter<Exception>, IYamlTypeConverter
- Inheritance
-
ExceptionConverter
- Implements
-
IYamlTypeConverter
- Inherited Members
Constructors
ExceptionConverter(bool, bool)
Initializes a new instance of the ExceptionConverter class.
public ExceptionConverter(bool includeStackTrace = false, bool includeData = false)
Parameters
includeStackTrace
boolA value that indicates if the stack of an exception is included in the converted result.
includeData
boolA value that indicates if the data of an exception is included in the converted result.
Properties
IncludeData
Gets a value indicating whether the data of an exception is included in the converted result.
public bool IncludeData { get; }
Property Value
- bool
true
if the data of an exception is included in the converted result; otherwise,false
.
IncludeStackTrace
Gets a value indicating whether the stack of an exception is included in the converted result.
public bool IncludeStackTrace { get; }
Property Value
- bool
true
if the stack of an exception is included in the converted result; otherwise,false
.
Methods
CanConvert(Type)
Determines whether this instance can convert the specified object type.
public override bool CanConvert(Type typeToConvert)
Parameters
typeToConvert
TypeType of the object.
Returns
- bool
true
if this instance can convert the specified object type; otherwise,false
.
ReadYaml(IParser, Type)
Reads and converts the YAML to Exception.
public override Exception ReadYaml(IParser reader, Type typeToConvert)
Parameters
reader
IParserThe reader to read from.
typeToConvert
TypeThe type to convert.
Returns
- Exception
The converted value.
Exceptions
WriteYaml(IEmitter, Exception)
Writes a specified value
as YAML.
public override void WriteYaml(IEmitter writer, Exception value)
Parameters
writer
IEmitterThe writer to write to.
value
ExceptionThe value to convert to YAML.