Home > Code Analysis > Code Issues – Try statement without catch or finally

Code Issues – Try statement without catch or finally

January 24th, 2011 Leave a comment Go to comments

This code issue shows an error if a ‘try’ statement doesn’t have a ‘catch’ or ‘finally’ statement. The try block must be completed, whether with catch or finally blocks.

The try block contains the guarded code that may cause the exception. The block is executed until an exception is thrown or it is completed successfully.

The catch block is used to take a control when any or a specific exception has been thrown.

The finally block is useful for cleaning up any resources allocated in the try block, as well as running any code that must execute even if there is an exception. Control is always passed to the finally block regardless of how the try block exits.

CodeRush Code Issues - Try statement without catch or finally

—–
Products: CodeRush Pro
Versions: 10.2 and up
VS IDEs: any
Updated: Feb/12/2011
ID: C057

Similar Posts:

  1. No comments yet. Be the first and leave a comment!
  1. January 25th, 2011 at 05:06 | #1