Data Structures | Defines

ai_error.hpp File Reference

Everything to query errors. More...

Data Structures

class  AIError
 Class that handles all error related functions. More...

Defines

#define EnforcePrecondition(returnval, condition)
 Helper to write precondition enforcers for the AI API in an abbreviated manner.
#define EnforcePreconditionCustomError(returnval, condition, error_code)
 Helper to write precondition enforcers for the AI API in an abbreviated manner.

Detailed Description

Everything to query errors.


Define Documentation

#define EnforcePrecondition (   returnval,
  condition 
)
Value:
if (!(condition)) {                                           \
    AIObject::SetLastError(AIError::ERR_PRECONDITION_FAILED);   \
    return returnval;                                           \
  }

Helper to write precondition enforcers for the AI API in an abbreviated manner.

Parameters:
returnval The value to return on failure.
condition The condition that must be obeyed.
#define EnforcePreconditionCustomError (   returnval,
  condition,
  error_code 
)
Value:
if (!(condition)) {                                                      \
    AIObject::SetLastError(error_code);                                    \
    return returnval;                                                      \
  }

Helper to write precondition enforcers for the AI API in an abbreviated manner.

Parameters:
returnval The value to return on failure.
condition The condition that must be obeyed.
error_code The error code passed to AIObject::SetLastError.