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
includeStackTraceboolA value that indicates if the stack of an exception is included in the converted result.
includeDataboolA 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
trueif 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
trueif 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
typeToConvertTypeType of the object.
Returns
- bool
trueif 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
readerIParserThe reader to read from.
typeToConvertTypeThe 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
writerIEmitterThe writer to write to.
valueExceptionThe value to convert to YAML.