RADE

C++ Source Checker

mkCheckSource Exception Checks

Testing source code in the CAA V5 environment
Technical Article

Abstract

This article describes the check relative to exceptions. This check is identified by EXCP.


Problematic

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]

Checks

Principle

When a method which can throw an exception is used, CSC checks if this method is included in a CATTry / CATCatch block.

EXCP

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.

Example EXCP-1

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]

Relative sections in setting files

For a more complete description of Setting Files, see [1].

ExceptionManagement_ThrowMethods

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.

ClassName
The name of the class (no ClassName means that it is a function)
MethodOrFunctionSign
The signature of the method or function

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]


In Short

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]


References

[1] Setting Files
[Top]

History

Version: 1 [May 2001] Document created
[Top]

Copyright © 2000, Dassault Systèmes. All rights reserved.