Class ExceptionConverter
- Assembly
- Codebelt.Extensions.Newtonsoft.Json.dll
Converts an Exception to or from JSON.
public class ExceptionConverter : JsonConverter
- Inheritance
-
JsonConverterExceptionConverter
- Inherited Members
-
JsonConverter.CanReadJsonConverter.CanWrite
Constructors
ExceptionConverter(Boolean, Boolean)
Initializes a new instance of the ExceptionConverter class.
public ExceptionConverter(bool includeStackTrace = false, bool includeData = false)
Parameters
includeStackTrace
BooleanA value that indicates if the stack of an exception is included in the converted result.
includeData
BooleanA 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
- Boolean
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
- Boolean
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 objectType)
Parameters
objectType
TypeType of the object.
Returns
- Boolean
true
if this instance can convert the specified object type; otherwise,false
.
ReadJson(JsonReader, Type, Object, JsonSerializer)
Reads the JSON representation of the object.
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
Parameters
reader
JsonReaderThe Newtonsoft.Json.JsonReader to read from.
objectType
TypeType of the object.
existingValue
ObjectThe existing value of object being read.
serializer
JsonSerializerThe calling serializer.
Returns
- Object
The object value.
WriteJson(JsonWriter, Object, JsonSerializer)
Writes the JSON representation of the object.
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
Parameters
writer
JsonWriterThe Newtonsoft.Json.JsonWriter to write to.
value
ObjectThe value.
serializer
JsonSerializerThe calling serializer.