public void OnDiagnosticHandledException(HttpContext httpContext, Exception exception) { var contextData = new ContextData(); contextData.SetSubmissionMethod("Microsoft.AspNetCore.Diagnostics.UnhandledException"); contextData.Add(nameof(HttpContext), httpContext); exception.ToExceptionless(contextData, _client).Submit(); }
/// <summary> /// Submits an unhandled exception event. /// </summary> /// <param name="client">The client instance.</param> /// <param name="exception">The unhandled exception.</param> public static void SubmitUnhandledException(this ExceptionlessClient client, Exception exception) { if (client == null) throw new ArgumentNullException(nameof(client)); var builder = exception.ToExceptionless(client: client); builder.PluginContextData.MarkAsUnhandledError(); builder.Submit(); }
public void OnMiddlewareException(HttpContext httpContext, Exception exception, string name) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod(name ?? "Microsoft.AspNetCore.MiddlewareAnalysis.MiddlewareException"); contextData.Add(nameof(HttpContext), httpContext); exception.ToExceptionless(contextData, _client).Submit(); }
private static Response OnError(NancyContext context, Exception exception) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("NancyPipelineException"); contextData.Add(NANCY_CONTEXT, context); exception.ToExceptionless(contextData).Submit(); return context.Response; }
public virtual bool HandleError(Exception exception) { var contextData = new ContextData(); contextData.MarkAsUnhandledError(); contextData.SetSubmissionMethod("WCFServiceError"); if (HttpContext.Current != null) contextData.Add("HttpContext", HttpContext.Current.ToWrapped()); exception.ToExceptionless(contextData).Submit(); return true; }
public static void LogInitializeException(Exception ex, Type ScheduledTaskType) { ex.ToExceptionless().Submit(); if (ex.InnerException != null) { Log(EventTypeIds.InitializeScheduledTasksExceptionWithInner, ScheduledTaskType.Name, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace); } else { Log(EventTypeIds.InitializeScheduledTasksException, ScheduledTaskType.Name, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace); } }
public static void LogInitializeException(Exception ex) { ex.ToExceptionless().Submit(); if (ex.InnerException != null) { Log(EventTypeIds.InitializeExceptionWithInner, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace); } else { Log(EventTypeIds.InitializeException, ex.GetType().Name, ex.Message, ex.StackTrace); } }
private void ShowCustomErrorPage(Exception exception) { var httpException = exception as HttpException ?? new HttpException(500, "Internal Server Error", exception); exception.ToExceptionless() .Submit(); this.SaveExceptionToDatabase(httpException); this.Response.Clear(); var routeData = new RouteData(); routeData.Values.Add("controller", "Error"); routeData.Values.Add("fromAppErrorEvent", true); switch (httpException.GetHttpCode()) { case 403: routeData.Values.Add("action", "AccessDenied"); break; case 404: routeData.Values.Add("action", "NotFound"); break; case 500: routeData.Values.Add("action", "ServerError"); break; default: routeData.Values.Add("action", "OtherHttpStatusCode"); routeData.Values.Add("httpStatusCode", httpException.GetHttpCode()); break; } this.Server.ClearError(); this.Response.TrySkipIisCustomErrors = true; this.Response.Headers.Add("Content-Type", "text/html"); IController controller = new ErrorController(); controller.Execute(new RequestContext(new HttpContextWrapper(this.Context), routeData)); }
/// <summary> /// Creates an exception event. /// </summary> /// <param name="client">The client instance.</param> /// <param name="exception">The exception.</param> public static EventBuilder CreateException(this ExceptionlessClient client, Exception exception) { if (client == null) throw new ArgumentNullException(nameof(client)); return exception.ToExceptionless(client: client); }
private void ToExceptionless(Exception ex, params object[] paramArray) { ex.ToExceptionless().AddObject(paramArray).Submit(); }
/// <summary> /// Creates an exception event. /// </summary> /// <param name="client">The client instance.</param> /// <param name="exception">The exception.</param> public static void CreateException(this ExceptionlessClient client, Exception exception) { exception.ToExceptionless(client: client).Submit(); }
public static void LogPluginException(string Component, Exception ex) { ex.ToExceptionless().AddObject(Component, "Component").Submit(); if (ex.InnerException != null) { Log(EventTypeIds.PluginExceptionWithInner, Component, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace); } else { Log(EventTypeIds.PluginException, Component, ex.GetType().Name, ex.Message, ex.StackTrace); } }
private void ProcessNotificationException(IMessage<ErrorNotification> message, Exception exception) { exception.ToExceptionless().AddDefaultInformation().MarkAsCritical().AddObject(message.GetBody()).AddTags("NotificationMQ").Submit(); Log.Error().Project(message.GetBody().ProjectId).Exception(exception).Message("Error sending notification.").Write(); }
private void ProcessErrorException(IMessage<Error> message, Exception exception) { exception.ToExceptionless().AddDefaultInformation().MarkAsCritical().AddObject(message.GetBody()).AddTags("ErrorMQ").Submit(); Log.Error().Project(message.GetBody().ProjectId).Exception(exception).Message("Error processing error.").Write(); _stats.Counter(StatNames.ErrorsProcessingFailed); }
private void ProcessEventException(IMessage<PersistentEvent> message, Exception exception) { exception.ToExceptionless().AddDefaultInformation().MarkAsCritical().AddObject(message.GetBody()).AddTags("ErrorMQ").Submit(); Log.Error().Project(message.GetBody().ProjectId).Exception(exception).Message("Error processing error.").Write(); }
public static void LogScheduledTaskException(string ScheduledTaskName, string SessionId, Type ScheduledTaskType, Exception ex) { ex.ToExceptionless() .AddTags("Scheduled Task") .AddObject(ScheduledTaskName, "ScheduledTaskName") .AddObject(ScheduledTaskType.Name, "ScheduledTaskTypeName") .Submit(); if (ex.InnerException != null) { Log(EventTypeIds.ScheduledTasksExceptionWithInner, ScheduledTaskName, SessionId, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace); } else { Log(EventTypeIds.ScheduledTasksException, ScheduledTaskName, SessionId, ScheduledTaskType.Assembly.Location, ex.GetType().Name, ex.Message, ex.StackTrace); } }
public static void LogInitializeException(string PluginFilename, Exception ex) { ex.ToExceptionless().AddObject(PluginFilename, "PluginFilename").Submit(); if (ex.InnerException != null) { Log(EventTypeIds.InitializeExceptionWithInner, PluginFilename, ex.GetType().Name, ex.Message, ex.StackTrace, ex.InnerException.GetType().Name, ex.InnerException.Message, ex.InnerException.StackTrace); } else { Log(EventTypeIds.InitializeException, PluginFilename, ex.GetType().Name, ex.Message, ex.StackTrace); } }
private void ProcessSummaryNotificationException(IMessage<SummaryNotification> message, Exception exception) { exception.ToExceptionless().AddDefaultInformation().MarkAsCritical().AddObject(message.GetBody()).AddTags("ErrorMQ").Submit(); Log.Error().Project(message.GetBody().Id).Exception(exception).Message("Error processing daily summary.").Write(); }
/// <summary> /// Submits an unhandled exception event. /// </summary> /// <param name="client">The client instance.</param> /// <param name="exception">The unhandled exception.</param> public static void SubmitUnhandledException(this ExceptionlessClient client, Exception exception) { var builder = exception.ToExceptionless(client: client); builder.EnrichmentContextData.MarkAsUnhandledError(); builder.Submit(); }
/// <summary> /// Creates an error to be reported to the Exceptionless server. /// </summary> /// <param name="ex">The exception to submit.</param> public static ErrorBuilder Create(Exception ex) { return ex.ToExceptionless(); }
/// <summary> /// Creates an exception event. /// </summary> /// <param name="client">The client instance.</param> /// <param name="exception">The exception.</param> public static EventBuilder CreateException(this ExceptionlessClient client, Exception exception) { return exception.ToExceptionless(client: client); }
private void WriteLogEntry(ErrorLevel level, object message, Exception exception = null) { string messageText = Convert.ToString(message); switch (level) { case ErrorLevel.Debug: this.log.Debug(messageText, exception); break; case ErrorLevel.Information: this.log.Info(messageText, exception); break; case ErrorLevel.Warning: this.log.Warn(messageText, exception); break; case ErrorLevel.Error: this.log.Error(messageText, exception); exception.ToExceptionless().Submit(); break; case ErrorLevel.Fatal: this.log.Fatal(messageText, exception); exception.ToExceptionless().MarkAsCritical().Submit(); break; default: throw new ArgumentOutOfRangeException("level"); } }