OpenVSP API Documentation  3.37.0
Functions
API Error Functions

Handling of OpenVSP ErrorObj information is accomplished through this group of API functions. Click here to return to the main page. More...

Functions

bool vsp::ErrorMgrSingleton::GetErrorLastCallFlag ()
 
int vsp::ErrorMgrSingleton::GetNumTotalErrors ()
 
ErrorObj vsp::ErrorMgrSingleton::PopLastError ()
 
ErrorObj vsp::ErrorMgrSingleton::GetLastError ()
 
void vsp::ErrorMgrSingleton::SilenceErrors ()
 
void vsp::ErrorMgrSingleton::PrintOnErrors ()
 

Detailed Description

Function Documentation

◆ GetErrorLastCallFlag()

bool vsp::ErrorMgrSingleton::GetErrorLastCallFlag ( )

Check if there was an error on the last call to the API

//==== Force API to silence error messages ====//
//==== Bogus Call To Create API Error ====//
Print( string( "---> Test Error Handling" ) );
SetParmVal( "BogusParmID", 23.0 );
if ( !GetErrorLastCallFlag() ) { Print( "---> Error: API GetErrorLastCallFlag " ); }
//==== Tell API to print error messages ====//
double SetParmVal(const std::string &parm_id, double val)
Returns
False if no error, true otherwise

◆ GetLastError()

ErrorObj vsp::ErrorMgrSingleton::GetLastError ( )

Return the most recent error from the stack (does NOT pop error off the stack)

//==== Force API to silence error messages ====//
Print( "Creating an API error" );
SetParmVal( "ABCDEFG", "Test_Name", "Test_Group", 123.4 );
//==== Check For API Errors ====//
ErrorObj err = GetLastError();
Print( err.GetErrorString() );
//==== Tell API to print error messages ====//
See also
SilenceErrors, PrintOnErrors;
Returns
Error object

◆ GetNumTotalErrors()

int vsp::ErrorMgrSingleton::GetNumTotalErrors ( )

Count the total number of errors on the stack

//==== Force API to silence error messages ====//
Print( "Creating an API error" );
SetParmVal( "ABCDEFG", "Test_Name", "Test_Group", 123.4 );
//==== Check For API Errors ====//
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
Print( err.GetErrorString() );
}
//==== Tell API to print error messages ====//
Returns
Number of errors

◆ PopLastError()

ErrorObj vsp::ErrorMgrSingleton::PopLastError ( )

Pop (remove) and return the most recent error from the stack. Note, errors are printed on occurrence by default.

//==== Force API to silence error messages ====//
Print( "Creating an API error" );
SetParmVal( "ABCDEFG", "Test_Name", "Test_Group", 123.4 );
//==== Check For API Errors ====//
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
Print( err.GetErrorString() );
}
//==== Tell API to print error messages ====//
Returns
Error object

◆ PrintOnErrors()

void vsp::ErrorMgrSingleton::PrintOnErrors ( )
inline

Cause errors to be printed to stdout as they occur.

//==== Force API to silence error messages ====//
Print( "Creating an API error" );
SetParmVal( "ABCDEFG", "Test_Name", "Test_Group", 123.4 );
//==== Tell API to print error messages ====//
See also
SilenceErrors

Definition at line 373 of file APIErrorMgr.h.

◆ SilenceErrors()

void vsp::ErrorMgrSingleton::SilenceErrors ( )
inline

Prevent errors from printing to stdout as they occur.

//==== Force API to silence error messages ====//
Print( "Creating an API error" );
SetParmVal( "ABCDEFG", "Test_Name", "Test_Group", 123.4 );
//==== Tell API to print error messages ====//
See also
PrintOnErrors

Definition at line 338 of file APIErrorMgr.h.