Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ecl::Error Class Reference

The primary error handler for ecl libraries. More...

#include <handlers.hpp>

Public Member Functions

 Error (const ErrorFlag &flag=UnknownError)
 Configure the return type with an error flag. More...
 
virtual ErrorFlag flag () const
 The flag identifying the error identified with this error handler. More...
 
virtual void operator= (const ErrorFlag &error)
 
virtual void print (const char *loc)
 Print a location dependent message to standard out. More...
 
virtual const char * what () const
 A simple string verbosely representing the error that is handled. More...
 
virtual ~Error ()
 

Protected Member Functions

virtual const char * argNotSupportedErrorString () const
 
virtual const char * blockingErrorString () const
 
virtual const char * busyErrorString () const
 
virtual const char * closeErrorString () const
 
virtual const char * configurationErrorString () const
 
virtual const char * connectErrorString () const
 
virtual const char * connectionRefusedString () const
 
virtual const char * constructorErrorString () const
 
virtual const char * conversionErrorString () const
 
virtual const char * destructorErrorString () const
 
virtual const char * interruptedErrorString () const
 
virtual const char * invalidArgErrorString () const
 
virtual const char * invalidObjectErrorString () const
 
virtual const char * isLockedErrorString () const
 
virtual const char * isTimeOutErrorString () const
 
virtual const char * memoryErrorString () const
 
virtual const char * noErrorString () const
 
virtual const char * notFoundErrorString () const
 
virtual const char * notInitialisedErrorString () const
 
virtual const char * notSupportedErrorString () const
 
virtual const char * openErrorString () const
 
virtual const char * outOfRangeErrorString () const
 
virtual const char * outOfResourcesErrorString () const
 
virtual const char * permissionsErrorString () const
 
virtual const char * raiiErrorString () const
 
virtual const char * readErrorString () const
 
virtual const char * systemFailureErrorString () const
 
virtual const char * unknownErrorString () const
 
virtual const char * usageErrorString () const
 
virtual const char * writeErrorString () const
 

Protected Attributes

ErrorFlag error_flag
 

Detailed Description

The primary error handler for ecl libraries.

This class is mostly used as the return type for ecl functions to indicate errors.

Error f(const int &i) {
if ( i == 3 ) {
return Error(NoError);
else {
}
}
// code
Error error = f(5);
if ( error.flag() != NoError ) {
std::cout << error.what() << std::endl; // OR
error.print(LOC); // for a verbose message with code location added.
}

Alternatively the class can be inherited and the verbose messages overloaded. Refer to the TimeError class in ecl_time_lite for an example.

Definition at line 64 of file handlers.hpp.

Constructor & Destructor Documentation

◆ Error()

ecl::Error::Error ( const ErrorFlag flag = UnknownError)
inline

Configure the return type with an error flag.

Parameters
flag: the type of error that is to be returned.

Definition at line 77 of file handlers.hpp.

◆ ~Error()

virtual ecl::Error::~Error ( )
inlinevirtual

Definition at line 78 of file handlers.hpp.

Member Function Documentation

◆ argNotSupportedErrorString()

virtual const char* ecl::Error::argNotSupportedErrorString ( ) const
inlineprotectedvirtual

Definition at line 168 of file handlers.hpp.

◆ blockingErrorString()

virtual const char* ecl::Error::blockingErrorString ( ) const
inlineprotectedvirtual

Definition at line 173 of file handlers.hpp.

◆ busyErrorString()

virtual const char* ecl::Error::busyErrorString ( ) const
inlineprotectedvirtual

Definition at line 170 of file handlers.hpp.

◆ closeErrorString()

virtual const char* ecl::Error::closeErrorString ( ) const
inlineprotectedvirtual

Definition at line 157 of file handlers.hpp.

◆ configurationErrorString()

virtual const char* ecl::Error::configurationErrorString ( ) const
inlineprotectedvirtual

Definition at line 159 of file handlers.hpp.

◆ connectErrorString()

virtual const char* ecl::Error::connectErrorString ( ) const
inlineprotectedvirtual

Definition at line 160 of file handlers.hpp.

◆ connectionRefusedString()

virtual const char* ecl::Error::connectionRefusedString ( ) const
inlineprotectedvirtual

Definition at line 179 of file handlers.hpp.

◆ constructorErrorString()

virtual const char* ecl::Error::constructorErrorString ( ) const
inlineprotectedvirtual

Definition at line 153 of file handlers.hpp.

◆ conversionErrorString()

virtual const char* ecl::Error::conversionErrorString ( ) const
inlineprotectedvirtual

Definition at line 155 of file handlers.hpp.

◆ destructorErrorString()

virtual const char* ecl::Error::destructorErrorString ( ) const
inlineprotectedvirtual

Definition at line 154 of file handlers.hpp.

◆ flag()

virtual ErrorFlag ecl::Error::flag ( ) const
inlinevirtual

The flag identifying the error identified with this error handler.

Returns
ErrorFlag : the error flag.

Definition at line 84 of file handlers.hpp.

◆ interruptedErrorString()

virtual const char* ecl::Error::interruptedErrorString ( ) const
inlineprotectedvirtual

Definition at line 172 of file handlers.hpp.

◆ invalidArgErrorString()

virtual const char* ecl::Error::invalidArgErrorString ( ) const
inlineprotectedvirtual

Definition at line 158 of file handlers.hpp.

◆ invalidObjectErrorString()

virtual const char* ecl::Error::invalidObjectErrorString ( ) const
inlineprotectedvirtual

Definition at line 175 of file handlers.hpp.

◆ isLockedErrorString()

virtual const char* ecl::Error::isLockedErrorString ( ) const
inlineprotectedvirtual

Definition at line 176 of file handlers.hpp.

◆ isTimeOutErrorString()

virtual const char* ecl::Error::isTimeOutErrorString ( ) const
inlineprotectedvirtual

Definition at line 177 of file handlers.hpp.

◆ memoryErrorString()

virtual const char* ecl::Error::memoryErrorString ( ) const
inlineprotectedvirtual

Definition at line 165 of file handlers.hpp.

◆ noErrorString()

virtual const char* ecl::Error::noErrorString ( ) const
inlineprotectedvirtual

Definition at line 151 of file handlers.hpp.

◆ notFoundErrorString()

virtual const char* ecl::Error::notFoundErrorString ( ) const
inlineprotectedvirtual

Definition at line 178 of file handlers.hpp.

◆ notInitialisedErrorString()

virtual const char* ecl::Error::notInitialisedErrorString ( ) const
inlineprotectedvirtual

Definition at line 163 of file handlers.hpp.

◆ notSupportedErrorString()

virtual const char* ecl::Error::notSupportedErrorString ( ) const
inlineprotectedvirtual

Definition at line 169 of file handlers.hpp.

◆ openErrorString()

virtual const char* ecl::Error::openErrorString ( ) const
inlineprotectedvirtual

Definition at line 156 of file handlers.hpp.

◆ operator=()

virtual void ecl::Error::operator= ( const ErrorFlag error)
inlinevirtual

Definition at line 85 of file handlers.hpp.

◆ outOfRangeErrorString()

virtual const char* ecl::Error::outOfRangeErrorString ( ) const
inlineprotectedvirtual

Definition at line 152 of file handlers.hpp.

◆ outOfResourcesErrorString()

virtual const char* ecl::Error::outOfResourcesErrorString ( ) const
inlineprotectedvirtual

Definition at line 171 of file handlers.hpp.

◆ permissionsErrorString()

virtual const char* ecl::Error::permissionsErrorString ( ) const
inlineprotectedvirtual

Definition at line 164 of file handlers.hpp.

◆ print()

virtual void ecl::Error::print ( const char *  loc)
inlinevirtual

Print a location dependent message to standard out.

Usage:

Error error = f(5);
if ( error.flag() != NoError ) {
error.print(LOC);
}
Parameters
loc: use with the LOC macro.

Definition at line 106 of file handlers.hpp.

◆ raiiErrorString()

virtual const char* ecl::Error::raiiErrorString ( ) const
inlineprotectedvirtual

Definition at line 167 of file handlers.hpp.

◆ readErrorString()

virtual const char* ecl::Error::readErrorString ( ) const
inlineprotectedvirtual

Definition at line 161 of file handlers.hpp.

◆ systemFailureErrorString()

virtual const char* ecl::Error::systemFailureErrorString ( ) const
inlineprotectedvirtual

Definition at line 174 of file handlers.hpp.

◆ unknownErrorString()

virtual const char* ecl::Error::unknownErrorString ( ) const
inlineprotectedvirtual

Definition at line 180 of file handlers.hpp.

◆ usageErrorString()

virtual const char* ecl::Error::usageErrorString ( ) const
inlineprotectedvirtual

Definition at line 166 of file handlers.hpp.

◆ what()

virtual const char* ecl::Error::what ( ) const
inlinevirtual

A simple string verbosely representing the error that is handled.

Returns
const char* : verbose representation of the error.

Definition at line 115 of file handlers.hpp.

◆ writeErrorString()

virtual const char* ecl::Error::writeErrorString ( ) const
inlineprotectedvirtual

Definition at line 162 of file handlers.hpp.

Member Data Documentation

◆ error_flag

ErrorFlag ecl::Error::error_flag
protected

Definition at line 182 of file handlers.hpp.


The documentation for this class was generated from the following file:
LOC
#define LOC
Stringify the line of code you are at.
Definition: macros.hpp:67
ecl::NoError
@ NoError
Definition: flags.hpp:51
ecl::Error::Error
Error(const ErrorFlag &flag=UnknownError)
Configure the return type with an error flag.
Definition: handlers.hpp:77
ecl::OutOfRangeError
@ OutOfRangeError
Definition: flags.hpp:53


ecl_errors
Author(s): Daniel Stonier
autogenerated on Wed Mar 2 2022 00:13:55