SmartAssembly 6

Reporting handled exceptions

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:

  1. Reference the dependency %ProgramFiles%\Red Gate\SmartAssembly 6\SDK\bin\SmartAssembly.ReportException.dll (this dependency will be removed when processed).
  2. 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;
          }
       }
    }
  3. The error reporting dialog box is shown (unless the Automatic template is enabled).
  4. The program continues after the exception has been reported.

Didn't find what you were looking for?