00001 /* 00002 * $Id: Exception.cpp,v 1.6 2002/08/05 18:56:22 mindstorm2600 Exp $ 00003 * 00004 * This is the main class for exception treatment, this section 00005 * is going to be completely rewritten 00006 * 00007 */ 00008 #include<Exception.h> 00009 #include<errno.h> 00010 #include<string.h> 00011 #include<dlfcn.h> 00012 namespace clawsoft{ 00013 00014 Exception::Exception():Object("Exception"){ 00015 description = "Generic Exception"; 00016 } 00017 00018 Exception::Exception(const char *d):Object("Exception"){ 00019 if(d == 0) 00020 description = "Generic Exception"; 00021 else 00022 description = (char *)d; 00023 } 00024 00025 const char *Exception::toString(){ 00026 return description; 00027 } 00028 00029 ArrayOutOfBoundsException::ArrayOutOfBoundsException(){ 00030 setClassName("ArrayOutOfBoundsException"); 00031 description = "Array out of bounds"; 00032 } 00033 00034 NullPointerException::NullPointerException(){ 00035 setClassName("NullPointerException"); 00036 description = "Null pointer"; 00037 } 00038 00039 NumberException::NumberException(){ 00040 setClassName("NumberException"); 00041 description = "Number exception"; 00042 } 00043 00044 ElementNotFoundException::ElementNotFoundException(){ 00045 setClassName("ElementNotFoundException"); 00046 description = "Element not found exception"; 00047 } 00048 00049 NoMoreTokensException::NoMoreTokensException(){ 00050 setClassName("NoMoreTokensException"); 00051 description = "No more tokens in this String"; 00052 } 00053 00054 MutexException::MutexException(){ 00055 setClassName("MutexException"); 00056 description = "Generic mutex exception"; 00057 } 00058 00059 UnableToLockMutexException::UnableToLockMutexException(){ 00060 setClassName("UnableToLockMutexException"); 00061 description = "Unable to lock mutex"; 00062 } 00063 00064 UnableToUnlockMutexException::UnableToUnlockMutexException(){ 00065 setClassName("UnableToUnlockMutexException"); 00066 description = "Unable to unlock mutex"; 00067 } 00068 00069 NetworkException::NetworkException(){ 00070 setClassName("NetworkException"); 00071 description = strerror(errno); 00072 } 00073 00074 ConnectionTimeoutException::ConnectionTimeoutException(){ 00075 setClassName("ConnectionTimeoutException"); 00076 description = "Connection timeout while attempting to contact the remote host"; 00077 } 00078 00079 ConnectionRefusedException::ConnectionRefusedException(){ 00080 setClassName("ConnectionRefusedException"); 00081 description = "Connection refused by the other host"; 00082 } 00083 00084 NetworkUnreachableException::NetworkUnreachableException(){ 00085 setClassName("NetworkUnreachableException"); 00086 description = "Connection refused by the other host"; 00087 } 00088 00089 IOException::IOException(){ 00090 setClassName("IOException"); 00091 description = strerror(errno); 00092 } 00093 00094 BrokenPipeException::BrokenPipeException(){ 00095 setClassName("BrokenPipeException"); 00096 description = "Broken pipe while doing an I/O operation"; 00097 } 00098 00099 SocketAlreadyBoundedException::SocketAlreadyBoundedException(){ 00100 setClassName("SocketAlreadyBoundedException"); 00101 description = "Socket already bounded :-("; 00102 } 00103 00104 SocketAlreadyUsedException::SocketAlreadyUsedException(){ 00105 setClassName("SocketAlreadyUsedException"); 00106 description = "Another socket is already listening through this port :-("; 00107 } 00108 00109 ProcOutOfFileDescriptorsException::ProcOutOfFileDescriptorsException(){ 00110 setClassName("ProcOutOfFileDescriptorsException"); 00111 description = "There are not enough file descriptors for this process"; 00112 } 00113 00114 SysOutOfFileDescriptorsException::SysOutOfFileDescriptorsException(){ 00115 setClassName("SysOutOfFileDescriptorsException"); 00116 description = "There are not enough file descriptors in the system"; 00117 } 00118 00119 SocketUnableToWriteException::SocketUnableToWriteException(){ 00120 setClassName("SocketUnableToWriteException"); 00121 description = "Unable to send data to the other host"; 00122 } 00123 00124 SocketUnableToReadException::SocketUnableToReadException(){ 00125 setClassName("SocketUnableToReadException"); 00126 description = "Unable to recieve data from the other host"; 00127 } 00128 00129 DSOException::DSOException(const char *msg){ 00130 setClassName("DSOException"); 00131 if(msg) 00132 description = (char *)msg; 00133 else 00134 description = "Dynamic Shared Object generic exception"; 00135 } 00136 00137 CantLoadDSOException::CantLoadDSOException(){ 00138 setClassName("CantLoadDSOException"); 00139 description = dlerror(); 00140 } 00141 00142 CantUnloadDSOException::CantUnloadDSOException(){ 00143 setClassName("CantUnloadDSOException"); 00144 description = dlerror(); 00145 } 00146 00147 DSOSymbolException::DSOSymbolException(){ 00148 setClassName("DSOSymbolException"); 00149 description = dlerror(); 00150 } 00151 00152 };
Powered by: