void context_Error(object sender, EventArgs e) { HttpApplication application = (HttpApplication)sender; HoptoadClient client = new HoptoadClient(); Exception exception = application.Server.GetLastError(); client.Send(exception); }
private void context_Error(object sender, EventArgs e) { try { var application = (HttpApplication)sender; var exception = application.Server.GetLastError(); exception = (exception.GetType() == typeof(HttpUnhandledException)) ? exception.InnerException : exception; var client = new HoptoadClient(exception); client.Send(); } catch (Exception ex) { // TODO: Log the swallowed error... // We don't want to cause problems to the application if this // thing is not working so we swallow everything. We could log // the error for further inspection... } }
/// <summary> /// /// </summary> /// <param name="exception"></param> public static void SendToHoptoad(this Exception exception) { var client = new HoptoadClient(exception); client.Send(); }