public TestGetExceptional() { // // TODO: Add constructor logic here // exSender = new GetExceptional(API_KEY); }
public void OnError(Object source, EventArgs e) { HttpContext ctx = HttpContext.Current; HttpRequest request = ctx.Request; Exception exception = ctx.Server.GetLastError(); //the one we ultimately want to report may be inner to an httpunhandled exception if (exception.InnerException != null) exception = exception.InnerException; string apiKey = ConfigurationSettings.AppSettings[CONF_API_KEY]; if (null == apiKey) { throw new Exception("The ApiKey for GetExceptional was not provided. Did you include " + CONF_API_KEY + " in the appSettings section of your web.config?"); } //report a 404 if found GetExceptional exReporter = new GetExceptional(apiKey); if (exception is HttpException && ((HttpException)exception).GetHttpCode() == 404) { exReporter.ReportException(new NotFoundException(), request, null, true); } else { exReporter.ReportException(exception, request, ctx.Session, true); } }