mirror of
https://github.com/sphildreth/roadie
synced 2024-11-26 22:20:21 +00:00
20 lines
No EOL
569 B
C#
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);
|
|
}
|
|
}
|
|
} |