roadie/Roadie.Api.Library/Extensions/ExceptionExt.cs

20 lines
569 B
C#
Raw Normal View History

2018-11-03 21:21:36 +00:00
using System;
namespace Roadie.Library.Extensions
{
public static class ExceptionExt
{
public static string Serialize(this Exception input)
{
2018-11-04 20:33:37 +00:00
if (input == null)
2018-11-03 21:21:36 +00:00
{
return null;
}
var settings = new Newtonsoft.Json.JsonSerializerSettings
{
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore
};
return Newtonsoft.Json.JsonConvert.SerializeObject(input, Newtonsoft.Json.Formatting.Indented, settings);
}
}
2018-11-04 20:33:37 +00:00
}