/// <summary> /// GetError /// </summary> protected static String GetError(Exception ex, CSharpLessExceptionError? error = null) { if (ex.IsNull()) return GetError(error: error); if (!ex.InnerException.IsNull()) return GetError(ex.InnerException.Message, error); return GetError(ex.Message, error); }
/// <summary> /// CSharpLessException /// </summary> public CSharpLessException(Exception ex, CSharpLessExceptionError? error = null) : base(GetError(ex, error)) { }
/// <summary> /// GetError /// </summary> protected static String GetError(String message = null, CSharpLessExceptionError? error = null) { var _error = error.IsNull() ? CSharpLessExceptionError.DefaultError.GetDescription() : error.GetDescription(); var _message = message.IsValid() ? message : _error; return String.Format("CSharpLess Exception: {0}", _message); }
/// <summary> /// CSharpLessException /// </summary> public CSharpLessException(String message = null, CSharpLessExceptionError? error = null) : base(GetError(message, error)) { }