public static void LogException(Exception exception, bool visibleToUser, ExceptionSeverity exceptionSeverity) { try { switch(exceptionSeverity) { case ExceptionSeverity.FatalException: case ExceptionSeverity.ErrorException: ShowMessage(string.Format("{0}: {1}", exceptionSeverity, exception.Message), ConsoleColor.Red); Trace.TraceError(string.Format("{0} [{1}]", exception.Message, CreateString(exception.Data))); RegisterExceptionAsync(exception, visibleToUser, exceptionSeverity); break; case ExceptionSeverity.WarningException: ShowMessage(string.Format("{0}: {1}", exceptionSeverity, exception.Message), ConsoleColor.Yellow); Trace.TraceError(string.Format("{0} [{1}]", exception.Message, CreateString(exception.Data))); RegisterExceptionAsync(exception, visibleToUser, exceptionSeverity); break; case ExceptionSeverity.InformationException: if (IsInDebugMode()) { ShowMessage(string.Format("{0}: {1}", exceptionSeverity, exception.Message), ConsoleColor.Cyan); Trace.TraceInformation(exception.Message); } break; default: throw new ArgumentOutOfRangeException(string.Format("Unknown exception severity {0}.", exceptionSeverity)); } } catch (Exception exp) { ShowMessage(exp.Message, ConsoleColor.DarkMagenta); } }
// ReSharper disable TooManyDependencies public WarewolfException(string message, Exception innerException, ExceptionType exceptionType, ExceptionSeverity severity) : base(message, innerException ?? new Exception()) // ReSharper restore TooManyDependencies { Severity = severity; ExceptionType = exceptionType; }
public WarewolfException(string message, Exception innerException, ExceptionType exceptionType, ExceptionSeverity severity) : base(message, innerException ?? new Exception()) { Severity = severity; ExceptionType = exceptionType; }
public void Log(string msg, ExceptionSeverity severity) { switch (severity) { case ExceptionSeverity.Info: Info(msg); break; case ExceptionSeverity.Warn: Warn(msg); break; case ExceptionSeverity.Error: Error(msg); break; case ExceptionSeverity.Fatal: Fatal(msg); break; default: Error(msg); break; } }
public void ThrowException(string message, ExceptionSeverity severity = ExceptionSeverity.Warning, params string[] values) { string mess = string.Format(message, values); LinksException ex = new LinksException(mess, severity); // TODO: send an email if error throw ex; }
public RegistrationException( string message, Exception innerException = null, ExceptionSeverity severity = DEFAULT_EXCEPTION_SEVERITY) : base(message, innerException) { Severity = severity; }
/// <summary> /// Sets the message value. /// </summary> /// <param name="type">The type.</param> /// <param name="methodName">Name of the method.</param> /// <param name="id">The id.</param> /// <param name="severity">The severity.</param> public void SetMessageValue(System.Type type, string methodName, string id, ExceptionSeverity severity) { this.assemblyName = type.Assembly.FullName; this.className = type.Name; this.severity = severity; this.methodName = methodName; this.id = id; }
public LogMessage SaveLogMessage2Db(ExceptionSeverity severity, string message) { LogMessage log = new LogMessage(); log.ExceptionSeverityId = severity; log.Message = message; db.Logs.Add(log); db.SaveChanges(); return(log); }
public void LogException(Exception exception, ExceptionSeverity severity) { switch (severity) { case ExceptionSeverity.Severe: serilogLogger.Fatal(exception, string.Empty); break; default: serilogLogger.Error(exception, string.Empty); break; } }
/// <summary> /// Clear /// initializes or reinitializes all member variables. /// </summary> public void Clear() { this.assemblyName = String.Empty; //this.resourceNamePrefix = "HighJump.AdvantagePlatform.Tools.AdvArch.Model.Core."; //TODO DELETE THIS this.className = String.Empty; this.detailMessage = String.Empty; this.detailParameters = new StringBuilder(); this.id = String.Empty; this.methodName = String.Empty; //this.modelAssembly = Assembly.GetAssembly( typeof( MessagePacket ) ); //TODO DELETE THIS this.severity = ExceptionSeverity.Informational; this.summaryMessage = String.Empty; this.summaryParameters = new StringBuilder(); this.thrownBy = new StringBuilder(); }
public static MagickException CreateException(IntPtr exception) { ExceptionSeverity severity = (ExceptionSeverity)NativeMagickExceptionHelper.Severity(exception); string message = NativeMagickExceptionHelper.Message(exception); string description = NativeMagickExceptionHelper.Description(exception); if (!string.IsNullOrEmpty(description)) { message += " (" + description + ")"; } List <MagickException> innerExceptions = CreateRelatedExceptions(exception); MagickException result = Create(severity, message); result.SetRelatedException(innerExceptions); return(result); }
public static void LogException(Exception exception, bool visibleToUser, ExceptionSeverity exceptionSeverity) { try { switch (exceptionSeverity) { case ExceptionSeverity.FatalException: case ExceptionSeverity.ErrorException: ShowMessage(string.Format("{0}: {1}", exceptionSeverity, exception.Message), ConsoleColor.Red); Trace.TraceError(string.Format("{0} [{1}]", exception.Message, CreateString(exception.Data))); RegisterExceptionAsync(exception, visibleToUser, exceptionSeverity); break; case ExceptionSeverity.WarningException: ShowMessage(string.Format("{0}: {1}", exceptionSeverity, exception.Message), ConsoleColor.Yellow); Trace.TraceError(string.Format("{0} [{1}]", exception.Message, CreateString(exception.Data))); RegisterExceptionAsync(exception, visibleToUser, exceptionSeverity); break; case ExceptionSeverity.InformationException: if (IsInDebugMode()) { ShowMessage(string.Format("{0}: {1}", exceptionSeverity, exception.Message), ConsoleColor.Cyan); Trace.TraceInformation(exception.Message); } break; default: throw new ArgumentOutOfRangeException(string.Format("Unknown exception severity {0}.", exceptionSeverity)); } } catch (Exception exp) { ShowMessage(exp.Message, ConsoleColor.DarkMagenta); } }
public EMMAReportingException(ExceptionSeverity severity, string message) : base(severity, message) { }
public EMMASettingsException(ExceptionSeverity severity, string message) : base(severity, message) { }
public LinksException(int code, string message, ExceptionSeverity severity) : base(message) { this.severity = severity; this.code = code; }
public EMMAReportingException(ExceptionSeverity severity) : base(severity, "Error in EMMA's reporting sub-system") { }
public SapphireDbException(string message, ExceptionSeverity severity = ExceptionSeverity.Warning) : base(message) { Severity = severity; }
public EMMAException(ExceptionSeverity severity, string message, bool writeToLog) : base(message) { this.severity = severity; if (writeToLog) { WriteToLog(); } }
private static void RegisterExceptionAsync(Exception exception, bool visibleToUser, ExceptionSeverity exceptionSeverity) { var registerExceptionTask = new Task(() => RegisterExceptionEx(exception, visibleToUser, exceptionSeverity)); registerExceptionTask.Start(); }
/// <summary> /// Invalid access token exception with a custom message and a custom severity. /// </summary> /// <param name="message"></param> /// <param name="exceptionSeverity"></param> public InvalidAccessTokenException(string message, ExceptionSeverity exceptionSeverity) : base(message) { this.ExceptionSeverity = exceptionSeverity; }
private static void RegisterExceptionEx(Exception exception, bool visibleToUser, ExceptionSeverity exceptionSeverity) { try { EnsureSessionEx(); Debug.WriteLine("Provide {0} to tharga.support service when possible.", exceptionSeverity); Issue.Register(exception, visibleToUser); } catch (Exception exp) { Trace.TraceError(string.Format("Cannot register exception using tharga.support. {0}", exp.Message)); } }
/// <summary> /// Forbidden exception with a custom message and a custom severity. /// </summary> /// <param name="message"></param> /// <param name="exceptionSeverity"></param> public ForbiddenException(string message, ExceptionSeverity exceptionSeverity) : base(message) { this.ExceptionSeverity = exceptionSeverity; }
/// <summary> /// Invalid data exception with a custom message and custom severity. /// </summary> /// <param name="message"></param> /// <param name="exceptionSeverity"></param> public InvalidDataException(string message, ExceptionSeverity exceptionSeverity) : base(message) { this.ExceptionSeverity = exceptionSeverity; }
public EMMADataException(ExceptionSeverity severity, string message) : base(severity, message) { }
public SapphireDbException(string message, Exception innerException, ExceptionSeverity severity = ExceptionSeverity.Error) : base(message, innerException) { Severity = severity; }
public EMMADataMissingException(ExceptionSeverity severity, string tableName, string key) : base(severity, "Data is missing from EMMA's database") { this.tableName = tableName; this.key = key; }
/// <summary> /// Submit an exception to exceptron Servers. /// </summary> /// <param name="exception">Exception that is being reported</param> /// <param name="component" /// example="DataAccess, Configuration, Registration, etc." /// remarks="It is common to use the logger name that was used to log the exception as the component.">Component that experienced this exception.</param> /// <param name="severity">Severity of the exception being reported</param> /// <param name="message" /// example="Something went wrong while checking for application updates.">Any message that should be attached to this exceptions</param> /// <param name="userId" /// remarks="This Id does not have to be tied to the user's identity. /// You can use a system generated unique ID such as GUID. /// This field is used to report how many unique users are experiencing an error." /// example=" /// 62E5C8EF-0CA2-43AB-B278-FC6994F776ED /// [email protected] /// 26437 /// ">ID that will uniquely identify the user</param> /// <param name="httpContext"><see cref="System.Web.HttpContext"/> in which the exception occurred. If no <see cref="System.Web.HttpContext"/> is provided /// <see cref="ExceptronClient"/> will try to get the current <see cref="System.Web.HttpContext"/> from <see cref="System.Web.HttpContext.Current"/></param> /// <returns></returns> public ExceptionResponse SubmitException(Exception exception, string component, ExceptionSeverity severity = ExceptionSeverity.None, string message = null, string userId = null) { var exceptionData = new ExceptionData { Exception = exception, Component = component, Severity = severity, Message = message, UserId = userId }; return SubmitException(exceptionData); }
private ExceptionNotification(string message, Exception exception, ExceptionSeverity severity) { Message = message; Exception = exception; Severity = severity; }
public EMMAInvalidPasswordException(ExceptionSeverity severity) : base(severity, "Invalid password entered") { }
public EMMAException(ExceptionSeverity severity, string message, Exception inner) : base(message, inner) { this.severity = severity; WriteToLog(); }
public EMMALicensingException(ExceptionSeverity severity) : base(severity, "Licensing problem") { }
public EMMACompressionException(ExceptionSeverity severity) : base(severity, "Error in EMMA's file compression sub-system") { }
public LinksException(string message, ExceptionSeverity severity) : base(message) { this.severity = severity; }
public EMMAInvalidPasswordException(ExceptionSeverity severity, string message, Exception inner) : base(severity, message, inner) { }
protected DataAccessLayerException(string message, ExceptionSeverity exceptionSeverity) : base(message) { this.ExceptionSeverity = exceptionSeverity; }
public EMMALicensingException(ExceptionSeverity severity, string message) : base(severity, message) { }
public WebApiException(string errorText, ExceptionSeverity severity) { ErrorText = errorText; Severity = severity; }
public EMMACompressionException(ExceptionSeverity severity, string message, Exception inner) : base(severity, message, inner) { }
private static MagickException Create(ExceptionSeverity severity, string message) { switch (severity) { case ExceptionSeverity.BlobWarning: return(new MagickBlobWarningException(message)); case ExceptionSeverity.CacheWarning: return(new MagickCacheWarningException(message)); case ExceptionSeverity.CoderWarning: return(new MagickCoderWarningException(message)); case ExceptionSeverity.ConfigureWarning: return(new MagickConfigureWarningException(message)); case ExceptionSeverity.CorruptImageWarning: return(new MagickCorruptImageWarningException(message)); case ExceptionSeverity.DelegateWarning: return(new MagickDelegateWarningException(message)); case ExceptionSeverity.DrawWarning: return(new MagickDrawWarningException(message)); case ExceptionSeverity.FileOpenWarning: return(new MagickFileOpenWarningException(message)); case ExceptionSeverity.ImageWarning: return(new MagickImageWarningException(message)); case ExceptionSeverity.MissingDelegateWarning: return(new MagickMissingDelegateWarningException(message)); case ExceptionSeverity.ModuleWarning: return(new MagickModuleWarningException(message)); case ExceptionSeverity.OptionWarning: return(new MagickOptionWarningException(message)); case ExceptionSeverity.PolicyWarning: return(new MagickPolicyWarningException(message)); case ExceptionSeverity.RegistryWarning: return(new MagickRegistryWarningException(message)); case ExceptionSeverity.ResourceLimitWarning: return(new MagickResourceLimitWarningException(message)); case ExceptionSeverity.StreamWarning: return(new MagickStreamWarningException(message)); case ExceptionSeverity.TypeWarning: return(new MagickTypeWarningException(message)); case ExceptionSeverity.BlobError: return(new MagickBlobErrorException(message)); case ExceptionSeverity.CacheError: return(new MagickCacheErrorException(message)); case ExceptionSeverity.CoderError: return(new MagickCoderErrorException(message)); case ExceptionSeverity.ConfigureError: return(new MagickConfigureErrorException(message)); case ExceptionSeverity.CorruptImageError: return(new MagickCorruptImageErrorException(message)); case ExceptionSeverity.DelegateError: return(new MagickDelegateErrorException(message)); case ExceptionSeverity.DrawError: return(new MagickDrawErrorException(message)); case ExceptionSeverity.FileOpenError: return(new MagickFileOpenErrorException(message)); case ExceptionSeverity.ImageError: return(new MagickImageErrorException(message)); case ExceptionSeverity.MissingDelegateError: return(new MagickMissingDelegateErrorException(message)); case ExceptionSeverity.ModuleError: return(new MagickModuleErrorException(message)); case ExceptionSeverity.OptionError: return(new MagickOptionErrorException(message)); case ExceptionSeverity.PolicyError: return(new MagickPolicyErrorException(message)); case ExceptionSeverity.RegistryError: return(new MagickRegistryErrorException(message)); case ExceptionSeverity.ResourceLimitError: return(new MagickResourceLimitErrorException(message)); case ExceptionSeverity.StreamError: return(new MagickStreamErrorException(message)); case ExceptionSeverity.TypeError: return(new MagickTypeErrorException(message)); default: if (severity < ExceptionSeverity.Error) { return(new MagickWarningException(message)); } else { return(new MagickErrorException(message)); } } }
public EMMASettingsException(ExceptionSeverity severity) : base(severity, "Error in EMMA's settings sub-system") { }
/// <summary> /// Show an exception dialog of varying severity: /// ExceptionSeverity.Warning /// Does not abort the program /// Buttons: [Ok] /// ExceptionSeverity.Error /// A (possibly expected) error that can be recovered from. /// Buttons: [Debug] [Ignore] [Abort] /// ExceptionSeverity.Unhandled /// An unexpected/unhandled exception, probably caught by the global exception handler function. /// The exception can still be ignored, but this may lead to abnormal program operation. /// Buttons: [Debug] [Ignore] [Abort] /// ExceptionSeverity.Critical /// An unrecoverable error - user can only abort the program /// Buttons: [Debug] [Abort] /// </summary> /// <param name="message">The message to present to the user</param> /// <param name="ex">The exception that caused this message to appear (optional)</param> /// <param name="severity">The severity of the exception</param> /// <returns>The button that was clicked</returns> public static ModalResult ShowException(string message, Exception ex = null, ExceptionSeverity severity = ExceptionSeverity.Error) { var fm = new ExceptionDialog(); fm.messageLabel.Text = (message != null) ? message : ""; if (ex != null) { if (message != null) { fm.messageLabel.Text += "\n\nDetail:\n"; } fm.messageLabel.Text += ex.Message; fm.detailsLabel.Text = "Exception Details:\n\n" + BuildExceptionDetails(ex); } else { fm.detailsGrid.Visibility = Visibility.Hidden; fm.btnShowDetails.Visibility = Visibility.Hidden; } fm.Title = "HexLight Controller"; switch (severity) { case ExceptionSeverity.Critical: fm.btnIgnore.Visibility = Visibility.Collapsed; fm.btnDebug.Visibility = Visibility.Collapsed; fm.btnOk.Visibility = Visibility.Collapsed; fm.btnAbort.IsCancel = true; fm.btnAbort.IsDefault = true; fm.Title += " - Critical Error"; break; case ExceptionSeverity.Unhandled: fm.btnOk.Visibility = Visibility.Collapsed; fm.btnAbort.IsCancel = true; fm.btnAbort.IsDefault = true; fm.Title += " - Unhandled Exception"; break; case ExceptionSeverity.Error: fm.btnOk.Visibility = Visibility.Collapsed; //fm.btnAbort.Visibility = Visibility.Collapsed; fm.btnIgnore.IsCancel = true; fm.btnIgnore.IsDefault = true; fm.Title += " - Error"; break; case ExceptionSeverity.Warning: fm.btnDebug.Visibility = Visibility.Collapsed; fm.btnAbort.Visibility = Visibility.Collapsed; fm.btnIgnore.Visibility = Visibility.Collapsed; fm.btnOk.IsCancel = true; fm.btnOk.IsDefault = true; fm.Title += " - Error"; break; } fm.ShowDialog(); // Shutdown the app if required if (severity == ExceptionSeverity.Critical || fm.modalResult == ModalResult.Abort) { Application.Current.Shutdown(1); System.Environment.Exit(1); return(fm.modalResult); } if (fm.modalResult == ModalResult.Debug) { Debugger.Launch(); Debugger.Break(); // Welcome, you have been brought here from the [Debug] button. // Where to from here? // - Try stepping out to see what caused the exception // - Examin the stack traces to see what caused the exception } return(fm.modalResult); }
public EMMADataException(ExceptionSeverity severity) : base(severity, "Error in EMMA's database sub-system") { }
/// <summary> /// Too many requests exception with a custom message and custom severity. /// </summary> /// <param name="message"></param> /// <param name="exceptionSeverity"></param> public TooManyRequestsException(string message, ExceptionSeverity exceptionSeverity) : base(message) { this.ExceptionSeverity = exceptionSeverity; }
public EMMADataException(ExceptionSeverity severity, string message, Exception inner) : base(severity, message, inner) { }
private static MagickException Create(ExceptionSeverity severity, string message, MagickException innerExceptions) { switch (severity) { case ExceptionSeverity.BlobWarning: return new MagickBlobWarningException(message, innerExceptions); case ExceptionSeverity.CacheWarning: return new MagickCacheWarningException(message, innerExceptions); case ExceptionSeverity.CoderWarning: return new MagickCoderWarningException(message, innerExceptions); case ExceptionSeverity.ConfigureWarning: return new MagickConfigureWarningException(message, innerExceptions); case ExceptionSeverity.CorruptImageWarning: return new MagickCorruptImageWarningException(message, innerExceptions); case ExceptionSeverity.DelegateWarning: return new MagickDelegateWarningException(message, innerExceptions); case ExceptionSeverity.DrawWarning: return new MagickDrawWarningException(message, innerExceptions); case ExceptionSeverity.FileOpenWarning: return new MagickFileOpenWarningException(message, innerExceptions); case ExceptionSeverity.ImageWarning: return new MagickImageWarningException(message, innerExceptions); case ExceptionSeverity.MissingDelegateWarning: return new MagickMissingDelegateWarningException(message, innerExceptions); case ExceptionSeverity.ModuleWarning: return new MagickModuleWarningException(message, innerExceptions); case ExceptionSeverity.OptionWarning: return new MagickOptionWarningException(message, innerExceptions); case ExceptionSeverity.PolicyWarning: return new MagickPolicyWarningException(message, innerExceptions); case ExceptionSeverity.RegistryWarning: return new MagickRegistryWarningException(message, innerExceptions); case ExceptionSeverity.ResourceLimitWarning: return new MagickResourceLimitWarningException(message, innerExceptions); case ExceptionSeverity.StreamWarning: return new MagickStreamWarningException(message, innerExceptions); case ExceptionSeverity.TypeWarning: return new MagickTypeWarningException(message, innerExceptions); case ExceptionSeverity.BlobError: return new MagickBlobErrorException(message, innerExceptions); case ExceptionSeverity.CacheError: return new MagickCacheErrorException(message, innerExceptions); case ExceptionSeverity.CoderError: return new MagickCoderErrorException(message, innerExceptions); case ExceptionSeverity.ConfigureError: return new MagickConfigureErrorException(message, innerExceptions); case ExceptionSeverity.CorruptImageError: return new MagickCorruptImageErrorException(message, innerExceptions); case ExceptionSeverity.DelegateError: return new MagickDelegateErrorException(message, innerExceptions); case ExceptionSeverity.DrawError: return new MagickDrawErrorException(message, innerExceptions); case ExceptionSeverity.FileOpenError: return new MagickFileOpenErrorException(message, innerExceptions); case ExceptionSeverity.ImageError: return new MagickImageErrorException(message, innerExceptions); case ExceptionSeverity.MissingDelegateError: return new MagickMissingDelegateErrorException(message, innerExceptions); case ExceptionSeverity.ModuleError: return new MagickModuleErrorException(message, innerExceptions); case ExceptionSeverity.OptionError: return new MagickOptionErrorException(message, innerExceptions); case ExceptionSeverity.PolicyError: return new MagickPolicyErrorException(message, innerExceptions); case ExceptionSeverity.RegistryError: return new MagickRegistryErrorException(message, innerExceptions); case ExceptionSeverity.ResourceLimitError: return new MagickResourceLimitErrorException(message, innerExceptions); case ExceptionSeverity.StreamError: return new MagickStreamErrorException(message, innerExceptions); case ExceptionSeverity.TypeError: return new MagickTypeErrorException(message, innerExceptions); default: if (severity < ExceptionSeverity.Error) return new MagickWarningException(message, innerExceptions); else return new MagickErrorException(message, innerExceptions); } }
public EMMADataMissingException(ExceptionSeverity severity, string message, Exception inner, string tableName, string key) : base(severity, message, inner) { this.tableName = tableName; this.key = key; }
public EMMAEveAPIException(ExceptionSeverity severity) : base(severity, "Error in EMMA's Eve API communication sub-system") { }
/// <summary> /// Submit an exception to exceptron Servers. /// </summary> /// <param name="exception">Exception that is being reported</param> /// <param name="component" /// example="DataAccess, Configuration, Registration, etc." /// remarks="It is common to use the logger name that was used to log the exception as the component.">Component that experienced this exception.</param> /// <param name="severity">Severity of the exception being reported</param> /// <param name="message" /// example="Something went wrong while checking for application updates.">Any message that should be attached to this exceptions</param> /// <param name="userId" /// remarks="This Id does not have to be tied to the user's identity. /// You can use a system generated unique ID such as GUID. /// This field is used to report how many unique users are experiencing an error." /// example=" /// 62E5C8EF-0CA2-43AB-B278-FC6994F776ED /// [email protected] /// 26437 /// ">ID that will uniquely identify the user</param> /// <param name="httpContext"><see cref="System.Web.HttpContext"/> in which the exception occurred. If no <see cref="System.Web.HttpContext"/> is provided /// <see cref="ExceptronClient"/> will try to get the current <see cref="System.Web.HttpContext"/> from <see cref="System.Web.HttpContext.Current"/></param> /// <returns></returns> public ExceptionResponse SubmitException(Exception exception, string component, ExceptionSeverity severity = ExceptionSeverity.None, string message = null, string userId = null, HttpContext httpContext = null) { var exceptionData = new ExceptionData { Exception = exception, Component = component, Severity = severity, Message = message, UserId = userId, HttpContext = httpContext }; return(SubmitException(exceptionData)); }
public EMMAEveAPIException(ExceptionSeverity severity, int eveApiErrorCode, string eveApiErrorDesc) : base(severity, "Eve API error.\r\nCode: " + eveApiErrorCode + "\r\nDescription: " + eveApiErrorDesc, eveApiErrorCode != 101 && eveApiErrorCode != 102 && eveApiErrorCode != 103 && eveApiErrorCode != 117) { this.eveCode = eveApiErrorCode; this.eveDescription = eveApiErrorDesc; }
public EMMAException(ExceptionSeverity severity) : base("EMMA has encountered an unspecified error.") { this.severity = severity; WriteToLog(); }
public SapphireDbException(ExceptionSeverity severity = ExceptionSeverity.Warning) { Severity = severity; }
public LogMessage Log(ExceptionSeverity severity, string message, params string[] values) { string mess = string.Format(message, values); return(ds.SaveLogMessage2Db(severity, mess)); }
/// <summary> /// Model not found exception with a custom message and a custom severity. /// </summary> /// <param name="message"></param> /// <param name="exceptionSeverity"></param> public ModelNotFoundException(string message, ExceptionSeverity exceptionSeverity) : base(message) { this.ExceptionSeverity = exceptionSeverity; }