nrEngine::Exception Class Reference
[Exception & Errors]

Exception thrown by the engine if any non returnable error occurs. More...


Public Member Functions

 Exception (Result number, const std::string &description, const std::string &source)
 Exception (Result number, const std::string &description, const std::string &source, char *file, long line)
 Exception (const Exception &rhs)

Static Public Member Functions

static void Assert (bool exp, const char *szExp, const char *szFilename, const char *szFuncName, int iLineNum)


Detailed Description

Exception thrown by the engine if any non returnable error occurs.

nrEngine does use return codes to indicate that an error occurs. This is done because of performance and code styling reasons. So the user does not have to encapsulate each function call of the engine into try{}catch(){} block. Instead of this just only check the return value of the function.
But sometimtes we need to throw an error instead of return back an error code. This is done for example in constructors and destructors, where you are not able to return any value.
For such cases you have to catch up the error thrown by the engine. Each exception object is of this class.
Probably in next releases of the engine we will go away from the return codes to the exception system.

Definition at line 57 of file Exception.h.


Constructor & Destructor Documentation

nrEngine::Exception::Exception ( Result  number,
const std::string &  description,
const std::string &  source 
)

Default constructor.

Parameters:
number Error code. Can be combined of more than one error code
description Description of the esception
source Where was exception thrown (function name)

Definition at line 22 of file Exception.cpp.

nrEngine::Exception::Exception ( Result  number,
const std::string &  description,
const std::string &  source,
char *  file,
long  line 
)

Advanced constructor.

Parameters:
number Error code. Can be combined of more than one error code
description Description of the esception
source Where was exception thrown (function name)
file In which file was the exception
line Where was the exception thrown

Definition at line 30 of file Exception.cpp.

nrEngine::Exception::Exception ( const Exception rhs  ) 

Copy constructor.

Definition at line 43 of file Exception.cpp.

References description, file, lineNumber, number, and source.


Member Function Documentation

void nrEngine::Exception::Assert ( bool  exp,
const char *  szExp,
const char *  szFilename,
const char *  szFuncName,
int  iLineNum 
) [static]

Assert function declared as static to allow using without initialisation of the object itself. This function will generate a formatted error message and will log it.

Parameters:
exp Boolean expression to be checked (false = fail)
szExp Error message
szFilename Filename of the file where error happens
szFuncName Name of the function where assertion is checked
iLineNum Line number where assert fails

Definition at line 84 of file Exception.cpp.


The documentation for this class was generated from the following files:
Generated on Wed Sep 12 23:19:43 2007 for nrEngine by  doxygen 1.5.1