00001 #ifndef _EXCEPTIONS_HPP 00002 #define _EXCEPTIONS_HPP 00003 00004 00005 #include <exception> 00006 #include <iostream> 00007 #include <string> 00008 #include "generic/Logger.hpp" 00009 00010 using namespace std; 00011 namespace brics_oodl { 00012 00013 class FileNotFoundException : public std::ios_base::failure { 00014 string msg; 00015 00016 public: 00017 // Takes a character string describing the error. 00018 explicit FileNotFoundException(const string& message) throw () :std::ios_base::failure(message) { 00019 msg = message; 00020 LOG(oodl_exception) << message; 00021 }; 00022 00023 virtual ~FileNotFoundException() throw () { 00024 }; 00025 00026 // Returns a C-style character string describing the general cause of the current error 00027 virtual const char* what() const throw () { 00028 return msg.c_str(); 00029 }; 00030 }; 00031 00032 class JointParameterException : public std::runtime_error { 00033 string msg; 00034 00035 public: 00036 // Takes a character string describing the error. 00037 explicit JointParameterException(const string& message) throw () :std::runtime_error(message) { 00038 msg = message; 00039 LOG(oodl_exception) << message; 00040 }; 00041 00042 virtual ~JointParameterException() throw () { 00043 }; 00044 00045 // Returns a C-style character string describing the general cause of the current error 00046 virtual const char* what() const throw () { 00047 return msg.c_str(); 00048 }; 00049 }; 00050 00051 class JointErrorException : public std::runtime_error { 00052 string msg; 00053 00054 public: 00055 // Takes a character string describing the error. 00056 explicit JointErrorException(const string& message) throw () :std::runtime_error(message) { 00057 msg = message; 00058 LOG(oodl_exception) << message; 00059 }; 00060 00061 virtual ~JointErrorException() throw () { 00062 }; 00063 00064 // Returns a C-style character string describing the general cause of the current error 00065 virtual const char* what() const throw () { 00066 return msg.c_str(); 00067 }; 00068 }; 00069 00070 00071 00072 00073 00074 } // namespace brics_oodl 00075 #endif //_EXCEPTIONS_HPP