Insert Exception / Error Handler

Top  Previous  Next

 C#   VB.NET   VB6   VBA 

The Insert Exception / Error Handler feature allows you to insert an exception / error handler in the current method, from customizable templates that can use predefined variables (whose value is assigned automatically by MZ-Tools, such as selected text, method name, etc.) or user-defined variables (whose value is asked when the exception / error handler is inserted).

MZ-Tools offers the following ways to insert an exception / error handler:

  • The MZ-Tools | Insert Exception / Error Handler menu.
  • The Insert Exception / Error Handler button on the MZ-Tools - Main toolbar.
  • In Visual Studio 2015 and higher, the keyboard shortcut associated with the MZTools.InsertExceptionHandler command.
  • In Visual Studio 2013 and lower, the keyboard shortcut associated with the MZTools8.InsertExceptionHandler command.
  • In VB6 / VBA, the keyboard shortcut associated with the Insert Error Handler feature.

If you have created more than one template, a window is shown to allow you to select the template to use:

ExceptionHandlerSelection

You can customize the templates in the Options window, Team Options tab, Exception / Error Handlers section.

The exception / error handler can be inserted in an empty method or around selected lines of code. In this case, the exception / error handler template should include the Selected Text ($P[SELECTED_TEXT]) predefined variable. See Predefined Variables

See Also:

Exception / Error Handlers Options

Predefined Variables

User-defined Variables

Keyboard Shortcuts Options