HandledState(bool handled, Bugsnag.Severity severity, SeverityReason reason) { _severity = severity; this.AddToPayload("unhandled", !handled); this.AddToPayload("severityReason", reason); string severityValue; switch (severity) { case Bugsnag.Severity.Info: severityValue = "info"; break; case Bugsnag.Severity.Warning: severityValue = "warning"; break; default: severityValue = "error"; break; } this.AddToPayload("severity", severityValue); }
/// <summary> /// Creates a HandledState object for an error report payload where the severity for the exception was modified /// while running the middleware/callback. /// </summary> /// <param name="severity"></param> /// <param name="previousSeverity"></param> /// <returns></returns> public static HandledState ForCallbackSpecifiedSeverity(Bugsnag.Severity severity, HandledState previousSeverity) { return(new HandledState(previousSeverity.Handled, severity, SeverityReason.ForCallbackSpecifiedSeverity())); }
/// <summary> /// Creates a HandledState object for an error report payload where the exception was handled by the application /// and notified manually and the error severity was also passed in to override the default severity. /// </summary> /// <param name="severity"></param> /// <returns></returns> public static HandledState ForUserSpecifiedSeverity(Bugsnag.Severity severity) { return(new HandledState(true, severity, null)); }