// check that exception initialized without message string can be safely handled and printed
try {
- Standard_OutOfRange::Raise();
+ throw Standard_OutOfRange();
}
- catch (Standard_Failure) {
+ catch (Standard_Failure const& anException) {
std::cout << "Caught successfully: ";
- Standard_Failure::Caught()->Print (std::cout);
- std::cout << endl;
+ std::cout << anException << endl;
}
return 0;
}
{
di << "Caught, OK\n";
}
- catch(Standard_Failure) {
+ catch(Standard_Failure const& anException) {
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
+ di << anException.GetMessageString();
di << ")... KO\n";
Succes = Standard_False;
}
-#ifndef NO_CXX_EXCEPTION
// this case tests if (...) supersedes (Standard_*),
// the normal behaviour is not
catch(...) {
di<<" unknown exception... (But) Ok\n";
}
-#endif
}
{//==== Test Divide ByZero (Real) ===========================================
{
di << "Caught, OK\n";
}
- catch(Standard_Failure) {
+ catch(Standard_Failure const& anException) {
//cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
+ di << anException.GetMessageString();
di << ")... KO\n";
Succes = Standard_False;
}
catch(Standard_Overflow) {
di << "Caught, OK\n";
}
- catch(Standard_Failure) {
+ catch(Standard_Failure const& anException) {
//cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
+ di << anException.GetMessageString();
di << ")... KO\n";
Succes = Standard_False;
}
{
di << "Caught, OK\n";
}
- catch(Standard_Failure) {
+ catch(Standard_Failure const& anException) {
//cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
+ di << anException.GetMessageString();
di << ")... KO\n";
Succes = Standard_False;
}
di << "Exception caught, KO\n";
Succes = Standard_False;
}
- catch(Standard_Failure) {
+ catch(Standard_Failure const& anException) {
//cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
+ di << anException.GetMessageString();
di << ")... KO\n";
Succes = Standard_False;
}
catch(Standard_NumericError) {
di << "Caught, OK\n";
}
- catch(Standard_Failure) {
+ catch(Standard_Failure const& anException) {
//cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
+ di << anException.GetMessageString();
di << ")... KO\n";
Succes = Standard_False;
}
#endif
{
di << "Caught, OK\n";
- } catch(Standard_Failure) {
+ } catch(Standard_Failure const& anException) {
//cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << endl;
di << " Caught (";
- di << Standard_Failure::Caught()->GetMessageString();
+ di << anException.GetMessageString();
di << ")... KO\n";
Succes = Standard_False;
}
catch(OSD_Exception_STACK_OVERFLOW) {
di << "Failed : STACK OVERFLOW\n\n";
}
- catch (Standard_Failure) {
+ catch (Standard_Failure const& anException) {
di << "Failed :\n\n";
//cout << Standard_Failure::Caught() << endl;
- di << Standard_Failure::Caught()->GetMessageString();
+ di << anException.GetMessageString();
}
di << argv[0] << " : Finish\n";
OCC_CATCH_SIGNALS
myExpr->Process( aString );
}
- catch(Standard_Failure) {
- Handle(Standard_Failure) aFail = Standard_Failure::Caught();
- di << "Exception : " << aFail->GetMessageString() << "\n";
+ catch(Standard_Failure const& anException) {
+ di << "Exception : " << anException.GetMessageString() << "\n";
}
return 0;