12 #ifndef ECL_ERRORS_HANDLERS_HPP_ 13 #define ECL_ERRORS_HANDLERS_HPP_ 94 virtual void print(
const char* loc) {
95 printf(
"%s - %s\n",loc,what());
103 virtual const char*
what()
const {
104 switch (error_flag) {
105 case (
NoError) : {
return noErrorString(); }
110 case (
OpenError) : {
return openErrorString(); }
111 case (
CloseError) : {
return closeErrorString(); }
115 case (
ReadError) : {
return readErrorString(); }
116 case (
WriteError) : {
return writeErrorString(); }
119 case (
MemoryError) : {
return memoryErrorString(); }
120 case (
UsageError) : {
return usageErrorString(); }
121 case (
RaiiError) : {
return raiiErrorString(); }
124 case (
BusyError) : {
return busyErrorString(); }
131 case (
TimeOutError) : {
return isTimeOutErrorString(); }
135 default : {
return unknownErrorString(); }
140 virtual const char*
outOfRangeErrorString()
const {
return "Out of range error - tried to access beyond the range of the object (usually container)."; }
144 virtual const char*
openErrorString()
const {
return "Could not open the requested object."; }
145 virtual const char*
closeErrorString()
const {
return "Could not close the requested object."; }
149 virtual const char*
readErrorString()
const {
return "Could not read from the object."; }
153 virtual const char*
memoryErrorString()
const {
return "There was a problem allocating the requested memory."; }
154 virtual const char*
usageErrorString()
const {
return "The object was used incorrectly."; }
155 virtual const char*
raiiErrorString()
const {
return "The object is pure RAII style and must be initialised correctly, you may not use the default constructor."; }
158 virtual const char*
busyErrorString()
const {
return "Resources are busy, operation is not permitted"; }
161 virtual const char*
blockingErrorString()
const {
return "A device marked as blocking, but used as non-blocking, or vice versa."; }
164 virtual const char*
isLockedErrorString()
const {
return "Invalidates attempts to work further because an object is locked."; }
167 virtual const char*
connectionRefusedString()
const {
return "The connection was refused by the listener at the other end of the connection."; }
virtual ErrorFlag flag() const
The flag identifying the error identified with this error handler.
virtual const char * busyErrorString() const
virtual const char * what() const
A simple string verbosely representing the error that is handled.
virtual const char * noErrorString() const
virtual const char * permissionsErrorString() const
virtual const char * argNotSupportedErrorString() const
Error(const ErrorFlag &flag=UnknownError)
Configure the return type with an error flag.
virtual const char * usageErrorString() const
virtual const char * outOfResourcesErrorString() const
virtual const char * notFoundErrorString() const
ErrorFlag
Enumerated flags for error message handling.
virtual void print(const char *loc)
Print a location dependent message to standard out.
The primary error handler for ecl libraries.
virtual const char * invalidArgErrorString() const
virtual const char * closeErrorString() const
virtual const char * connectErrorString() const
virtual const char * readErrorString() const
virtual const char * connectionRefusedString() const
virtual const char * raiiErrorString() const
virtual const char * constructorErrorString() const
virtual const char * systemFailureErrorString() const
virtual const char * destructorErrorString() const
virtual const char * notInitialisedErrorString() const
virtual const char * interruptedErrorString() const
virtual const char * invalidObjectErrorString() const
#define ecl_errors_PUBLIC
virtual const char * notSupportedErrorString() const
virtual const char * isTimeOutErrorString() const
virtual const char * memoryErrorString() const
virtual const char * conversionErrorString() const
virtual const char * blockingErrorString() const
virtual const char * openErrorString() const
virtual const char * unknownErrorString() const
virtual const char * configurationErrorString() const
virtual const char * isLockedErrorString() const
virtual const char * writeErrorString() const
virtual const char * outOfRangeErrorString() const
virtual void operator=(const ErrorFlag &error)