29 lines
1 KiB
Text
29 lines
1 KiB
Text
/**
|
|
|
|
\page cxx-exceptions Exception Handling
|
|
|
|
%Cantera throws exceptions of type CanteraError when an error is encountered. Your program should always catch these. You can throw CanteraError exceptions too, if you like, or you can use your own application-specific exception classes.
|
|
|
|
\include except.cpp
|
|
|
|
The function \c showErrors is a convenient way to display the error
|
|
message in the \c catch block. The \c error function prints an error
|
|
and terminates execution. Note that both of these functions are
|
|
environment-specific; i.e. they behave differently if you are running
|
|
your Cantera code embedded in a MATLAB application than if you run it
|
|
as a stand-alone C++ application. \see textlogs
|
|
|
|
The output generated when this program is run is shown below.
|
|
\verbatim
|
|
************************************************
|
|
Cantera Error!
|
|
************************************************
|
|
|
|
|
|
Procedure: mycode
|
|
Error: test of exception throwing and catching
|
|
|
|
|
|
program terminating.
|
|
\endverbatim
|
|
*/
|