Source/NFX/MiscUtils.cs
/// <summary>
/// If there is error, converts its details to JSOnDataMap
/// </summary>
If there is error, converts its details to JSOnDataMap
If there is error converts its details to JSOnDataMap
public static NFX.Serialization.JSON.JSONDataMap ToJSONDataMap(this Exception error, bool recurse = true, bool stackTrace = false)
    {
      if (error==null) return null;
      var result = new NFX.Serialization.JSON.JSONDataMap(false);
      result["Type"] = error.GetType().FullName;
      result["Msg"] = error.Message;
      result["Data"] = error.Data;
      result["Src"] = error.Source;
      if (stackTrace) result["STrace"] = error.StackTrace;
      if (recurse)
        result["Inner"] = error.InnerException.ToJSONDataMap(recurse);
      else
      {
        result["Inner.Type"] = error.InnerException!=null ? error.InnerException.GetType().FullName : null;
        result["Inner.Msg"] = error.InnerException!=null ? error.InnerException.Message : null;
        if (stackTrace) result["Inner.STrace"] = error.InnerException!=null ? error.InnerException.StackTrace : null;
      }
      return result;
    }
public static NFX . Serialization . JSON . JSONDataMap ToJSONDataMap ( this Exception error , bool recurse = true , bool stackTrace = false ) { if ( error == null ) return null ; var result = new NFX . Serialization . JSON . JSONDataMap ( false ) ; result [ " " ] = error . GetType ( ) . FullName ; result [ " " ] = error . Message ; result [ " " ] = error . Data ; result [ " " ] = error . Source ; if ( stackTrace ) result [ " " ] = error . StackTrace ; if ( recurse ) result [ " " ] = error . InnerException . ToJSONDataMap ( recurse ) ; else { result [ " " ] = error . InnerException != null ? error . InnerException . GetType ( ) . FullName : null ; result [ " " ] = error . InnerException != null ? error . InnerException . Message : null ; if ( stackTrace ) result [ " " ] = error . InnerException != null ? error . InnerException . StackTrace : null ; } return result ; }
If there is error, converts its details to JSOnDataMap
If there is error converts its details to JSOnDataMap
Exception
this
recurse
bool
stackTrace
bool