本文整理汇总了C#中System.Exception.ToExceptionless方法的典型用法代码示例。如果您正苦于以下问题:C# Exception.ToExceptionless方法的具体用法?C# Exception.ToExceptionless怎么用?C# Exception.ToExceptionless使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Exception
的用法示例。
在下文中一共展示了Exception.ToExceptionless方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnDiagnosticHandledException
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();
}
示例2: SubmitUnhandledException
/// <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();
}
示例3: OnMiddlewareException
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();
}
示例4: OnError
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;
}
示例5: HandleError
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;
}
示例6: LogInitializeException
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);
}
}
示例7: ShowCustomErrorPage
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));
}
示例8: CreateException
/// <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);
}
示例9: ToExceptionless
private void ToExceptionless(Exception ex, params object[] paramArray)
{
ex.ToExceptionless().AddObject(paramArray).Submit();
}
示例10: CreateException
/// <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();
}
示例11: LogPluginException
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);
}
}
示例12: ProcessNotificationException
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();
}
示例13: ProcessErrorException
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);
}
示例14: ProcessEventException
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();
}
示例15: LogScheduledTaskException
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);
}
}