Reporting handled exceptions
Published 31 December 2012
Once enabled, Automatic Error Reporting intercepts all unhandled exceptions and reports them to you automatically.
If required you can also report handled exceptions.
To report a handled exception:
- Reference the dependency %ProgramFiles%\Red Gate\SmartAssembly 6\SDK\bin\SmartAssembly.ReportException.dll (this dependency will be removed when processed).
For any public method that can throw an exception which you wish to report, create a try-catch block and add a call to
ExceptionReporting.Report
as follows:using SmartAssembly.ReportException; public class MyClass { public bool DoSomething() { try { DoSomethingInternal(); return true; } catch (Exception exception) { ExceptionReporting.Report(exception); return false; } } }
- The error reporting dialog box is shown (unless the Automatic template is enabled).
- The program continues after the exception has been reported.