cantera/docs/doxyinput/except.cpp
Ray Speth a6f939c2fe Applied consistent formatting to all C++ code
Done using astyle:
astyle --style=kr --add-brackets --indent=spaces=4 --indent-col1-comments --unpad-paren --pad-header --align-pointer=type --lineend=linux
2012-02-10 17:24:00 +00:00

21 lines
444 B
C++

#include <cantera/Cantera.h>
//
// artifical example of throwing and catching a CanteraError exception.
//
void mycode()
{
ThermoPhase* gas = newPhase("h2o2.cti","ohmech");
if (gas->temperature() < 3000.0) {
throw CanteraError("mycode","test of exception throwing and catching");
}
}
int main()
{
try {
mycode();
} catch (CanteraError) {
showErrors();
error("program terminating.");
}
}