DAVID4 SDK  1.8.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
david::ErrorExceptionConverter Class Reference

Easy conversion from error codes to exceptions. More...

#include <Exceptions.h>

Public Member Functions

 ErrorExceptionConverter (const std::string &source="")
 Constructor. More...
 
virtual ~ErrorExceptionConverter ()
 Destructor.
 
int operator= (int errorCode)
 Throws an exception, if 'errorCode' is less then zero. More...
 
ErrorExceptionConverteroperator() (const std::string &context)
 Set more context information to source. More...
 
std::string GetSource () const
 Get source information. More...
 
std::string GetContext () const
 Get context information. More...
 

Detailed Description

Easy conversion from error codes to exceptions.

The error code has to be one of david::ErrorCode.

Example:

eec = AnyFunctionWithErrorCodeAsReturnValue(); // will throw an exception, if return value < 0

Definition at line 133 of file Exceptions.h.

Constructor & Destructor Documentation

david::ErrorExceptionConverter::ErrorExceptionConverter ( const std::string &  source = "")
inline

Constructor.

Parameters
[in]sourceOptional source information.

Definition at line 138 of file Exceptions.h.

Member Function Documentation

std::string david::ErrorExceptionConverter::GetContext ( ) const
inline

Get context information.

Returns
Context information.

Definition at line 163 of file Exceptions.h.

std::string david::ErrorExceptionConverter::GetSource ( ) const
inline

Get source information.

Returns
Source information.

Definition at line 159 of file Exceptions.h.

ErrorExceptionConverter& david::ErrorExceptionConverter::operator() ( const std::string &  context)

Set more context information to source.

The context information will be available in source info of an exception. The automatic Id will be reset to zero.

Parameters
[in]contextMore context information.
Returns
Reference to itself.
int david::ErrorExceptionConverter::operator= ( int  errorCode)

Throws an exception, if 'errorCode' is less then zero.

An assignment will also increment the automatic Id. The automatic Id will will be available in source info of an exception.

Parameters
[in]errorCodeSee david::ErrorCode.
Returns
Error code.

The documentation for this class was generated from the following file: