RADE |
C++ Source Checker |
mkCheckSource Exception ChecksTesting source code in the CAA V5 environment |
Technical Article |
AbstractThis article describes the check relative to exceptions. This check is identified by EXCP. |
Some CAA methods can, in some particular cases, throw an exception. If this exception is not caught, it will cause the abort of the process.
[Top]
When a method which can throw an exception is used, CSC checks if this method is included in a CATTry / CATCatch block.
EXCP stands for EXCePtion not caught.
An error of type EXCP is reported when
If the exception is not caught, it will be send to the caller, until it is caught. If nobody catches the exception, the program will abort.
Let's assume that the global function CATBindInterface_B can throw an exception.
The following code will report an EXCP error
... SEQUENCE(octet) name= ...; CATIBindParameters* parameters= ...; CATILinkableObject* pointed= NULL; pointed= CATBindInterface_B( name, CATILinkableObject::ClassName(), parameters ); ... |
To correct the error, enclose the method in a CATTry block, followed by a CATCatch block dealing with the exception:
... SEQUENCE(octet) name= ...; CATIBindParameters* parameters= ...; CATILinkableObject* pointed= NULL; CATTry { pointed= CATBindInterface_B( name, CATILinkableObject::ClassName(), parameters ); } CATCatch( CATError, err ) { pointed= NULL; ... delete err; err= NULL; } ... |
[Top]
For a more complete description of Setting Files, see [1].
This section is located in: SettingsSet > OptionLists > ExceptionManagement_OptionLists
This section contains a list of Call. Each Call describes a method or function which can throw an exception.
Be careful:
Example 1
ClassName <none> MethodOrFunctionSign CATBindInterface_B(?,?,?)
This means that the function CATBindInterface_B with 3 arguments can throw an exception.
Example 2
ClassName CATBrepAccessImpl MethodOrFunctionSign GetLastFeature
This means that the method GetLastFeature (no matter the number of arguments) of the class CATBRepAccessImpl (or an inheriting class) can throw an exception.
[Top]
Non-caught exceptions lead directly to an abort of the application. CSC can prevent some of these aborts by pointing the basic methods not caught.
[Top]
[1] | Setting Files |
[Top] |
Version: 1 [May 2001] | Document created |
[Top] |
Copyright © 2000, Dassault Systèmes. All rights reserved.