12 #ifndef ECL_ERRORS_HANDLERS_HPP_
13 #define ECL_ERRORS_HANDLERS_HPP_
72 virtual ErrorFlag flag()
const {
return error_flag; }
73 virtual void operator=(
const ErrorFlag &error) { error_flag = error; }
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(); }
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(); }
139 virtual const char* noErrorString()
const {
return "No error."; }
140 virtual const char* outOfRangeErrorString()
const {
return "Out of range error - tried to access beyond the range of the object (usually container)."; }
141 virtual const char* constructorErrorString()
const {
return "The constructor did not produce a valid object."; }
142 virtual const char* destructorErrorString()
const {
return "The destructor failed to self destruct."; }
143 virtual const char* conversionErrorString()
const {
return "Conversion from one type to another failed."; }
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."; }
146 virtual const char* invalidArgErrorString()
const {
return "One of the supplied input arguments was invalid."; }
147 virtual const char* configurationErrorString()
const {
return "There was a configuration error."; }
148 virtual const char* connectErrorString()
const {
return "Could not connect."; }
149 virtual const char* readErrorString()
const {
return "Could not read from the object."; }
150 virtual const char* writeErrorString()
const {
return "Could not write to the object."; }
151 virtual const char* notInitialisedErrorString()
const {
return "The object has not been properly initialised yet."; }
152 virtual const char* permissionsErrorString()
const {
return "The caller does not have the required permissions."; }
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."; }
156 virtual const char* argNotSupportedErrorString()
const {
return "The combination of input arguments is not supported on this platform."; }
157 virtual const char* notSupportedErrorString()
const {
return "This operation is not supported on this platform."; }
158 virtual const char* busyErrorString()
const {
return "Resources are busy, operation is not permitted"; }
159 virtual const char* outOfResourcesErrorString()
const {
return "Out of resources, cannot proceed."; }
160 virtual const char* interruptedErrorString()
const {
return "This operation was interrupted."; }
161 virtual const char* blockingErrorString()
const {
return "A device marked as blocking, but used as non-blocking, or vice versa."; }
162 virtual const char* systemFailureErrorString()
const {
return "A subsystem has failed mid operation."; }
163 virtual const char* invalidObjectErrorString()
const {
return "Attempted to work on an invalid object."; }
164 virtual const char* isLockedErrorString()
const {
return "Invalidates attempts to work further because an object is locked."; }
165 virtual const char* isTimeOutErrorString()
const {
return "A timeout occured."; }
166 virtual const char* notFoundErrorString()
const {
return "The resource could not be found."; }
167 virtual const char* connectionRefusedString()
const {
return "The connection was refused by the listener at the other end of the connection."; }
168 virtual const char* unknownErrorString()
const {
return "Unknown error."; }