Added ExceptionConverter in JsonSerializerSettings at DocumentClient (#472)
This commit is contained in:
parent
20e24fc572
commit
7ceb3106aa
|
|
@ -1,14 +1,11 @@
|
|||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Elsa.Serialization.Converters
|
||||
{
|
||||
public class ExceptionConverter : JsonConverter<Exception>
|
||||
{
|
||||
|
||||
public override void WriteJson(JsonWriter writer, Exception value, JsonSerializer serializer)
|
||||
{
|
||||
throw new NotImplementedException("Unnecessary because CanRead is false. The type will skip the converter.");
|
||||
|
|
@ -22,7 +19,6 @@ namespace Elsa.Serialization.Converters
|
|||
var jObject = JObject.Load(reader);
|
||||
var ex = System.Text.Json.JsonSerializer.Deserialize<Exception>(jObject.ToString());
|
||||
return ex;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Elsa.Serialization.Converters;
|
||||
|
||||
namespace Elsa.Persistence.DocumentDb
|
||||
{
|
||||
|
|
@ -36,6 +37,8 @@ namespace Elsa.Persistence.DocumentDb
|
|||
}
|
||||
}.ConfigureForNodaTime(DateTimeZoneProviders.Tzdb);
|
||||
|
||||
settings.Converters.Add(new ExceptionConverter());
|
||||
|
||||
var connectionPolicy = ConnectionPolicy.Default;
|
||||
connectionPolicy.ConnectionMode = this.options.ConnectionMode;
|
||||
connectionPolicy.ConnectionProtocol = this.options.ConnectionProtocol;
|
||||
|
|
|
|||
Loading…
Reference in a new issue