00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 #include "VMS/Exception.h"
00074 #include <typeinfo>
00075
00076
00077 namespace Poco {
00078
00079
00080 Exception::Exception(int code): _pNested(0), _code(code)
00081 {
00082 }
00083
00084
00085 Exception::Exception(const std::string& msg, int code): _msg(msg), _pNested(0), _code(code)
00086 {
00087 }
00088
00089
00090 Exception::Exception(const std::string& msg, const std::string& arg, int code): _msg(msg), _pNested(0), _code(code)
00091 {
00092 if (!arg.empty())
00093 {
00094 _msg.append(": ");
00095 _msg.append(arg);
00096 }
00097 }
00098
00099
00100 Exception::Exception(const std::string& msg, const Exception& nested, int code): _msg(msg), _pNested(nested.clone()), _code(code)
00101 {
00102 }
00103
00104
00105 Exception::Exception(const Exception& exc):
00106 std::exception(exc),
00107 _msg(exc._msg),
00108 _code(exc._code)
00109 {
00110 _pNested = exc._pNested ? exc._pNested->clone() : 0;
00111 }
00112
00113
00114 Exception::~Exception() throw()
00115 {
00116 delete _pNested;
00117 }
00118
00119
00120 Exception& Exception::operator = (const Exception& exc)
00121 {
00122 if (&exc != this)
00123 {
00124 delete _pNested;
00125 _msg = exc._msg;
00126 _pNested = exc._pNested ? exc._pNested->clone() : 0;
00127 _code = exc._code;
00128 }
00129 return *this;
00130 }
00131
00132
00133 const char* Exception::name() const throw()
00134 {
00135 return "Exception";
00136 }
00137
00138
00139 const char* Exception::className() const throw()
00140 {
00141 return typeid(*this).name();
00142 }
00143
00144
00145 const char* Exception::what() const throw()
00146 {
00147 return name();
00148 }
00149
00150
00151 std::string Exception::displayText() const
00152 {
00153 std::string txt = name();
00154 if (!_msg.empty())
00155 {
00156 txt.append(": ");
00157 txt.append(_msg);
00158 }
00159 return txt;
00160 }
00161
00162
00163 Exception* Exception::clone() const
00164 {
00165 return new Exception(*this);
00166 }
00167
00168
00169 void Exception::rethrow() const
00170 {
00171 throw *this;
00172 }
00173
00174
00175 POCO_IMPLEMENT_EXCEPTION(LogicException, Exception, "Logic exception")
00176 POCO_IMPLEMENT_EXCEPTION(AssertionViolationException, LogicException, "Assertion violation")
00177 POCO_IMPLEMENT_EXCEPTION(NullPointerException, LogicException, "Null pointer")
00178 POCO_IMPLEMENT_EXCEPTION(BugcheckException, LogicException, "Bugcheck")
00179 POCO_IMPLEMENT_EXCEPTION(InvalidArgumentException, LogicException, "Invalid argument")
00180 POCO_IMPLEMENT_EXCEPTION(NotImplementedException, LogicException, "Not implemented")
00181 POCO_IMPLEMENT_EXCEPTION(RangeException, LogicException, "Out of range")
00182 POCO_IMPLEMENT_EXCEPTION(IllegalStateException, LogicException, "Illegal state")
00183 POCO_IMPLEMENT_EXCEPTION(InvalidAccessException, LogicException, "Invalid access")
00184 POCO_IMPLEMENT_EXCEPTION(SignalException, LogicException, "Signal received")
00185 POCO_IMPLEMENT_EXCEPTION(UnhandledException, LogicException, "Signal received")
00186
00187 POCO_IMPLEMENT_EXCEPTION(RuntimeException, Exception, "Runtime exception")
00188 POCO_IMPLEMENT_EXCEPTION(NotFoundException, RuntimeException, "Not found")
00189 POCO_IMPLEMENT_EXCEPTION(ExistsException, RuntimeException, "Exists")
00190 POCO_IMPLEMENT_EXCEPTION(TimeoutException, RuntimeException, "Timeout")
00191 POCO_IMPLEMENT_EXCEPTION(SystemException, RuntimeException, "System exception")
00192 POCO_IMPLEMENT_EXCEPTION(RegularExpressionException, RuntimeException, "Error in regular expression")
00193 POCO_IMPLEMENT_EXCEPTION(LibraryLoadException, RuntimeException, "Cannot load library")
00194 POCO_IMPLEMENT_EXCEPTION(LibraryAlreadyLoadedException, RuntimeException, "Library already loaded")
00195 POCO_IMPLEMENT_EXCEPTION(NoThreadAvailableException, RuntimeException, "No thread available")
00196 POCO_IMPLEMENT_EXCEPTION(PropertyNotSupportedException, RuntimeException, "Property not supported")
00197 POCO_IMPLEMENT_EXCEPTION(PoolOverflowException, RuntimeException, "Pool overflow")
00198 POCO_IMPLEMENT_EXCEPTION(NoPermissionException, RuntimeException, "No permission")
00199 POCO_IMPLEMENT_EXCEPTION(OutOfMemoryException, RuntimeException, "Out of memory")
00200 POCO_IMPLEMENT_EXCEPTION(DataException, RuntimeException, "Data error")
00201
00202 POCO_IMPLEMENT_EXCEPTION(DataFormatException, DataException, "Bad data format")
00203 POCO_IMPLEMENT_EXCEPTION(SyntaxException, DataException, "Syntax error")
00204 POCO_IMPLEMENT_EXCEPTION(CircularReferenceException, DataException, "Circular reference")
00205 POCO_IMPLEMENT_EXCEPTION(PathSyntaxException, SyntaxException, "Bad path syntax")
00206 POCO_IMPLEMENT_EXCEPTION(IOException, RuntimeException, "I/O error")
00207 POCO_IMPLEMENT_EXCEPTION(FileException, IOException, "File access error")
00208 POCO_IMPLEMENT_EXCEPTION(FileExistsException, FileException, "File exists")
00209 POCO_IMPLEMENT_EXCEPTION(FileNotFoundException, FileException, "File not found")
00210 POCO_IMPLEMENT_EXCEPTION(PathNotFoundException, FileException, "Path not found")
00211 POCO_IMPLEMENT_EXCEPTION(FileReadOnlyException, FileException, "File is read-only")
00212 POCO_IMPLEMENT_EXCEPTION(FileAccessDeniedException, FileException, "Access to file denied")
00213 POCO_IMPLEMENT_EXCEPTION(CreateFileException, FileException, "Cannot create file")
00214 POCO_IMPLEMENT_EXCEPTION(OpenFileException, FileException, "Cannot open file")
00215 POCO_IMPLEMENT_EXCEPTION(WriteFileException, FileException, "Cannot write file")
00216 POCO_IMPLEMENT_EXCEPTION(ReadFileException, FileException, "Cannot read file")
00217 POCO_IMPLEMENT_EXCEPTION(UnknownURISchemeException, RuntimeException, "Unknown URI scheme")
00218
00219
00220 POCO_IMPLEMENT_EXCEPTION(ApplicationException, Exception, "Application exception")
00221 POCO_IMPLEMENT_EXCEPTION(BadCastException, RuntimeException, "Bad cast exception")
00222
00223 }
00224