/// <summary> /// Build an report, but do not upload it /// </summary> /// <param name="exception">caught exception</param> /// <remarks> /// <para> /// Will collect context info and generate a report. /// </para> /// </remarks> public ErrorReportDTO Build(Exception exception) { var context = new ErrorReporterContext(null, exception); var contextInfo = _configuration.ContextProviders.Collect(context); var reportId = ReportIdGenerator.Generate(exception); return(new ErrorReportDTO(reportId, new ExceptionDTO(exception), contextInfo.ToArray())); }
/// <summary> /// Process exception. /// </summary> /// <param name="context"> /// Used to reports (like for ASP.NET) can attach information which can be used during the context /// collection pipeline. /// </param> /// <remarks> /// <para> /// Will collect context info, generate a report, go through filters and finally upload it. /// </para> /// </remarks> /// <returns> /// Report if filter allowed the generated report; otherwise <c>null</c>. /// </returns> /// <seealso cref="IReportFilter" /> public ErrorReportDTO Process(IErrorReporterContext context) { var contextInfo = _configuration.ContextProviders.Collect(context); var reportId = ReportIdGenerator.Generate(context.Exception); var report = new ErrorReportDTO(reportId, new ExceptionDTO(context.Exception), contextInfo.ToArray()); var canUpload = _configuration.FilterCollection.CanUploadReport(report); if (!canUpload) { return(null); } return(report); }
/// <summary> /// Process exception. /// </summary> /// <param name="exception">caught exception</param> /// <remarks> /// <para> /// Will collect context info, generate a report, go through filters and finally upload it. /// </para> /// </remarks> public void Process(Exception exception) { var context = new ErrorReporterContext(null, exception); var contextInfo = _configuration.ContextProviders.Collect(context); var reportId = ReportIdGenerator.Generate(exception); var report = new ErrorReportDTO(reportId, new ExceptionDTO(exception), contextInfo.ToArray()); var canUpload = _configuration.FilterCollection.CanUploadReport(report); if (!canUpload) { return; } _configuration.Uploaders.Upload(report); }