public override void OnException(ExceptionContext context) { if (Dismiss(context)) { return; } this.OneTrueCollector = new OneTrueCollector(); DefaultCollection(context); ElmahCollection(context); CustomCollection(OneTrueCollector, context); string errorId = null; try { errorId = OneTrueProxy.UploadMvcCollector(this.OneTrueCollector, this, context.Exception, context.HttpContext); } catch (Exception ex) { OnReportingException(context, ex); } context.HttpContext.Response.StatusCode = 500; context.Result = GetErrorView(context, errorId); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); app.UseBrowserLink(); } else { app.UseExceptionHandler("/Home/Error"); } app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Home}/{action=Index}/{id?}"); }); OneTrueProxy.Credentials(new Uri("http://localhost:50473/"), "5fb563d2b41144c0996b768064bdc5d1", "de7ff5583e8945ddb781c1f0662a2966"); }
static void Main(string[] args) { var url = new Uri("http://localhost:50473/"); OneTrueProxy.Credentials(url, "5fb563d2b41144c0996b768064bdc5d1", "de7ff5583e8945ddb781c1f0662a2966"); try { throw new InvalidOperationException("ReportGenerate OneTrueError.Client.SysCore.Demo"); } catch (Exception ex) { var dto = OneTrueProxy.GenerateUploadReport(ex); UploadScreenshots(dto.ReportId); } }
private static void UploadScreenshots(string errorId) { var reader = File.ReadAllBytes(@"E:\Local\OneTrueError\OneTrueError.SysCore\OneTrueError.Client.SysCore.Demo\Nuget\screenshots.jpg"); OneTrueProxy.UploadScreenshots(errorId, "SysCoreLib", Convert.ToBase64String(reader)); }