libCombine
C++ library for working with the COMBINE Archive format
Loading...
Searching...
No Matches
CaError Class Reference
+ Inheritance diagram for CaError:

Public Member Functions

 CaError (const unsigned int errorId=0, const unsigned int level=OMEX_DEFAULT_LEVEL, const unsigned int version=OMEX_DEFAULT_VERSION, const std::string &details="", const unsigned int line=0, const unsigned int column=0, const unsigned int severity=LIBCOMBINE_SEV_ERROR, const unsigned int category=LIBCOMBINE_CAT_OMEX)
 Creates a new CaError to report that something occurred during OMEX processing. More...
 
 CaError (const CaError &orig)
 Copy constructor; creates a copy of this CaError. More...
 
virtual ~CaError ()
 Destroys this CaError. More...
 

Constructor & Destructor Documentation

◆ CaError() [1/2]

CaError::CaError ( const unsigned int  errorId = 0,
const unsigned int  level = OMEX_DEFAULT_LEVEL,
const unsigned int  version = OMEX_DEFAULT_VERSION,
const std::string &  details = "",
const unsigned int  line = 0,
const unsigned int  column = 0,
const unsigned int  severity = LIBCOMBINE_SEV_ERROR,
const unsigned int  category = LIBCOMBINE_CAT_OMEX 
)

Creates a new CaError to report that something occurred during OMEX processing.

When a libCombine operation on OMEX content results in a warning, error or other diagnostic, the issue is reported as an CaError object. CaError objects have identification numbers to indicate the nature of the exception. The argument errorId to this constructor can be (but does not have to be) a value from this set of constants. If it is one of the predefined error identifiers, the CaError class assumes the error is a low-level system or OMEX layer error and prepends a built-in, predefined error message to any string passed in the argument details to this constructor. In addition, all the predefined error identifiers have associated values for the severity and category codes, and these fields are filled-in using the libCombine defaults for each different error identifier.

If the error identifier errorId is a number greater than 99999, the CaError class assumes the error was generated from another part of the software and does not do additional filling in of values beyond the default in the constructor itself. This allows CaError to serve as a base class for other errors, such as for user-defined validation rules (see Validator). Callers should fill in all the parameters with suitable values if generating errors with codes greater than 99999 to make maximum use of the CaError facilities.

As mentioned above, there are additional constants defined for standard severity and standard category codes, and every predefined error in libCombine has an associated value for severity and category taken from these predefined sets. These constants have symbol names prefixed with LIBCOMBINE_SEV_ and LIBCOMBINE_CAT_, respectively. If the value of errorId is one of the standard error codes, callers do not need to fill in severity and category in a call to this constructor. Conversely, if errorId is not an existing OMEX-level error code, callers can use other values for severity and category.

Please see the top of the documentation for CaError for a longer discussion of the possible error codes, their meanings, and their applicability to different combinations of Level+Version of OMEX.

Parameters
errorIdan unsigned int, the identification number of the error.
levelthe OMEX Level of the OMEX model
versionthe OMEX Version within the Level of the OMEX model
detailsa string containing additional details about the error. If the error code in errorId is one that is recognized by CaError, the given message is appended to a predefined message associated with the given code. If the error code is not recognized, the message is stored as-is as the text of the error.
linean unsigned int, the line number at which the error occured.
columnan unsigned int, the column number at which the error occured.
severityan integer indicating severity of the error.
categoryan integer indicating the category to which the error belongs.

◆ CaError() [2/2]

CaError::CaError ( const CaError orig)

Copy constructor; creates a copy of this CaError.

◆ ~CaError()

virtual CaError::~CaError ( )
virtual

Destroys this CaError.