You are here: AxTools > CodeSMART 2007 for VB6 > Documentation > User's Guide > Error Handling > Inserting and Removing Error Handlers
While browsing this page, why not start downloading the evaluation setup kit (direct download, no questions asked).

Inserting and Removing Error Handlers

CodeSMART can automatically insert and remove error handling code into your projects. In order to obtain the best results with the CodeSMART error handling system you must be familiar with the error handling schemes, error handling assignments and error handling scheme modifiers. Please jump to the Error handling schemes and assignments and Error handling scheme modifiers pages for details on these issues.

To insert error handlers:

  1. Open the project you want to insert the error handling code in and (if applicable, depending on the operation's scope) select a component or a single procedure.
  2. Click Insert Error Handling Code on the Code Edit Tools toolbar in order to display the Error Handlers Inserter dialog box (quick toolbar and menu references are available).
    Insert error hendlers
  3. Select the operation scope. Depending on the current position in code and the active code or designer window, only valid options are listed.
  4. If at step 2 you have selected the current procedure or component CodeSMART tries to select the corresponding error handling scheme according to your selection and the eventual error handling scheme modifiers and assignments. If you want to insert a different scheme than the one determined by CodeSMART then you should select it in the Current scheme combo box. The Preview will be updated in order to display how the code would look like in a hypothetic procedure.

    If you select a wider scope, like the project or the entire group you will not be allowed to specify a particular scheme. CodeSMART will cycle every component and every method inside that project or group and will determine the scheme to be inserted based on existing modifiers and the defined assignments.
  5. Press Begin to perform the insertion. Depending on the situation, a progress bar may appear to reflect the operation progress.

 Notes

  • The procedures that do not have modifier markers or special error handling schemes assignments inherit the component's error scheme. Also, components that do not have modifier markers or assignments use the default assignment.
    Error Handling sample
  • The two inserted error handling code blocks are delimited by CodeSMART with special comments. Don't remove any of these comments if you want CodeSMART to be able to automatically remove the error handling code it inserted.
  • If you want to prevent a component or procedure from being affected by the error handlers insertion then you should use the Skip modifier for that component or procedure.

To remove error handlers:

  1. Open the project you want to remove the error handling code from and (if applicable, depending on the operation's scope) select a component or a single procedure.
  2. Click the Remove Error Handling Code button on the Code Edit Tools toolbar in order to display the Error Handlers Remover dialog.
    Remove Error Handling code
  3. Specify the operation scope. Depending on the current position in code and the active code or designer window, only valid options are listed.
  4. Press Begin in order to start the operation.

 Notes

  • If a scheme contains line numbers then they will also be removed from the code.
  • If a component or procedure has an error handling scheme modifier marker specifying a scheme that is no longer valid then you should delete the modifier before proceeding with the error handling code removal.
  • To remove CodeSMART 3.x error handling code you should use the Remove old style (v3.x) error handlers tool whose dialog box is displayed by selecting the same entry in the CodeSMART main menu.
See also
Error Handling Overview
Error Handling Schemes And Assignments
Error Handling Scheme Modifiers
Inserting and Removing Line Numbers
Inserting and Removing Line Numbers from Command Line
Exception Handling Basics
Adding and Removing the Exception Handling Module

Back To Top

Copyright © 2008 AxTools - CodeSMART 2007 for VB6 - Error Handling