Changeset 2151:38ec4a930c05 in lemon-0.x for lemon/error.h
- Timestamp:
- 07/18/06 15:29:59 (18 years ago)
- Branch:
- default
- Phase:
- public
- Convert:
- svn:c9d7d8f5-90d6-0310-b91f-818b3a526b0e/lemon/trunk@2865
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lemon/error.h
r2150 r2151 177 177 ///\e 178 178 virtual ~Exception() throw() {} 179 180 ///\e 181 virtual const char* exceptionName() const { 179 ///\e 180 virtual const char* what() const throw() { 182 181 return "lemon::Exception"; 183 }184 185 ///\e186 virtual const char* what() const throw() {187 return exceptionName();188 182 } 189 183 }; … … 200 194 class LogicError : public Exception { 201 195 public: 202 virtual const char* exceptionName() const{196 virtual const char* what() const throw() { 203 197 return "lemon::LogicError"; 204 198 } … … 213 207 class UninitializedParameter : public LogicError { 214 208 public: 215 virtual const char* exceptionName() const{209 virtual const char* what() const throw() { 216 210 return "lemon::UninitializedParameter"; 217 211 } … … 228 222 class RuntimeError : public Exception { 229 223 public: 230 virtual const char* exceptionName() const{224 virtual const char* what() const throw() { 231 225 return "lemon::RuntimeError"; 232 226 } … … 236 230 class RangeError : public RuntimeError { 237 231 public: 238 virtual const char* exceptionName() const{232 virtual const char* what() const throw() { 239 233 return "lemon::RangeError"; 240 234 } … … 244 238 class IOError : public RuntimeError { 245 239 public: 246 virtual const char* exceptionName() const{240 virtual const char* what() const throw() { 247 241 return "lemon::IOError"; 248 242 } … … 305 299 try { 306 300 std::ostringstream ostr; 307 ostr << exceptionName()<< ": ";301 ostr << "lemon:DataFormatError" << ": "; 308 302 if (message()) ostr << message(); 309 303 if( file() || line() != 0 ) { … … 318 312 catch (...) {} 319 313 if( _message_holder.valid()) return _message_holder.get().c_str(); 320 return exceptionName(); 321 } 322 323 virtual const char* exceptionName() const { 324 return "lemon::DataFormatError"; 314 return "lemon:DataFormatError"; 325 315 } 326 316 … … 362 352 try { 363 353 std::ostringstream ostr; 364 ostr << exceptionName()<< ": ";354 ostr << "lemon::FileOpenError" << ": "; 365 355 ostr << "Cannot open file - " << file(); 366 356 _message_holder.set(ostr.str()); … … 368 358 catch (...) {} 369 359 if( _message_holder.valid()) return _message_holder.get().c_str(); 370 return exceptionName();371 }372 373 virtual const char* exceptionName() const {374 360 return "lemon::FileOpenError"; 375 361 } 376 377 362 virtual ~FileOpenError() throw() {} 378 363 }; … … 432 417 catch (...) {} 433 418 if( _message_holder.valid() ) return _message_holder.get().c_str(); 434 return exceptionName(); 435 } 436 437 virtual const char* exceptionName() const { 438 return "lemon::IOParameterError"; 439 } 440 419 return "lemon:IOParameterError"; 420 } 441 421 virtual ~IOParameterError() throw() {} 442 422 }; … … 486 466 catch(...) {} 487 467 if( _message_holder.valid() ) return _message_holder.get().c_str(); 488 return exceptionName();489 }490 491 virtual const char* exceptionName() const {492 468 return "lemon::AssertionFailedError"; 493 469 } 494 495 virtual ~AssertionFailedError() throw() {} 470 virtual ~AssertionFailedError() throw() {} 496 471 }; 497 472
Note: See TracChangeset
for help on using the changeset viewer.