roadie/Roadie.Api.Library/Extensions/ExceptionExt.cs
2019-07-03 11:21:29 -05:00

18 lines
No EOL
484 B
C#

using Newtonsoft.Json;
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 JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
};
return JsonConvert.SerializeObject(input, Formatting.Indented, settings);
}
}
}