OpenVSP API Documentation 3.42.3
 
Loading...
Searching...
No Matches
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...

Classes

class  vsp::ErrorObj
 

Functions

ERROR_CODE vsp::ErrorObj::GetErrorCode ()
 
string vsp::ErrorObj::GetErrorString ()
 
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


Class Documentation

◆ vsp::ErrorObj

class vsp::ErrorObj

ErrorObj is defined by an error code enum and associated error string.

Definition at line 44 of file APIErrorMgr.h.

Public Member Functions

 ErrorObj (ERROR_CODE err_code, const string &err_str)
 
 ErrorObj (const ErrorObj &from)
 
ERROR_CODE GetErrorCode ()
 
string GetErrorString ()
 
void NoError ()
 

Public Attributes

ERROR_CODE m_ErrorCode
 
string m_ErrorString
 

Constructor & Destructor Documentation

◆ ~ErrorObj()

vsp::ErrorObj::~ErrorObj ( )
inline

Definition at line 50 of file APIErrorMgr.h.

Member Function Documentation

◆ NoError()

void vsp::ErrorObj::NoError ( )
inline

Definition at line 117 of file APIErrorMgr.h.

Member Data Documentation

◆ m_ErrorCode

ERROR_CODE vsp::ErrorObj::m_ErrorCode

Definition at line 114 of file APIErrorMgr.h.

◆ m_ErrorString

string vsp::ErrorObj::m_ErrorString

Definition at line 115 of file APIErrorMgr.h.

Function Documentation

◆ GetErrorCode()

ERROR_CODE vsp::ErrorObj::GetErrorCode ( )
inline

Get the ERROR_CODE enum of the last raised error

ErrorObj err = PopLastError();
if ( err.GetErrorCode() != VSP_CANT_FIND_PARM ) { Print( "---> Error: API PopLast" ); }
ERROR_CODE GetErrorCode()
Definition APIErrorMgr.h:76
@ VSP_CANT_FIND_PARM
Definition APIDefines.h:480
See also
ERROR_CODE
Returns
ERROR_CODE error code enum

Definition at line 76 of file APIErrorMgr.h.

◆ 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

◆ GetErrorString()

string vsp::ErrorObj::GetErrorString ( )
inline

Get the error string of the last raised error

//==== Check For API Errors ====//
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
Print( err.GetErrorString() );
}
string GetErrorString()
Returns
Error string

Definition at line 108 of file APIErrorMgr.h.

◆ 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 ====//
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 )
{
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 )
{
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 383 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 348 of file APIErrorMgr.h.