roadie/Roadie.Api.Library/Extensions/ExceptionExt.cs
2018-12-26 13:39:13 -06:00

20 lines
No EOL
569 B
C#

using System;
namespace Roadie.Library.Extensions
{
public static class ExceptionExt
{
public static string Serialize(this Exception input)
{
if (input == null)
{
return null;
}
var settings = new Newtonsoft.Json.JsonSerializerSettings
{
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore
};
return Newtonsoft.Json.JsonConvert.SerializeObject(input, Newtonsoft.Json.Formatting.Indented, settings);
}
}
}