roadie/RoadieLibrary/Extensions/ExceptionExt.cs
Steven Hildreth c0d5e5dc24 WIP
2018-11-04 14:33:37 -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);
}
}
}