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 #include "UAP/UAPException.hpp"
00026 #include "UAP/UAPNode.hpp"
00027
00028 using namespace std;
00029
00030 UAPException::UAPException(const string& _message) : message(_message), cause(NULL) {}
00031
00032 UAPException::UAPException(const string& _message, const UAPException& _cause)
00033 : message(_message), cause(new UAPException(_cause)) {}
00034
00035 UAPException::~UAPException() throw() {}
00036
00037 string UAPException::getMessage() const
00038 {
00039 return message;
00040 }
00041
00042 UAPException* UAPException::getCause() const
00043 {
00044 return cause;
00045 }
00046
00047 void UAPException::printStackTrace(std::ostream& _file)
00048 {
00049 std::ostream* file = &_file;
00050 (*file) << message << std::endl;
00051 if (cause)
00052 cause->printStackTrace(_file);
00053 }
00054
00055 string UAPException::toString() const
00056 {
00057 return "Exception: " + message;
00058 }
00059
00060 std::ostream& operator << (std::ostream& os, const UAPException& except)
00061 {
00062 os << except.toString() << std::endl;
00063 return os;
00064 }
00065
00066 std::ostream& operator << (std::ostream& os, const UAPException* except)
00067 {
00068 os << except->toString() << std::endl;
00069 return os;
00070 }
00071
00072 UAPIOException::UAPIOException(const string& _message, const string& _file,
00073 int _line)
00074 : UAPException(_message), file(_file), line(_line) {}
00075
00076 UAPIOException::UAPIOException(const string& _message, const string& _file,
00077 int _line, const UAPException& _cause)
00078 : UAPException(_message, _cause), file(_file), line(_line) {}
00079
00080 UAPIOException::~UAPIOException() throw() {}
00081
00082 string UAPIOException::getFile() const
00083 {
00084 return file;
00085 }
00086
00087 int UAPIOException::getLineNumber() const
00088 {
00089 return line;
00090 }
00091
00092 string UAPIOException::toString() const
00093 {
00094 std::ostringstream result;
00095 result << "IOException: Occurred on line "<<line<<" in file \""<<file<<"\"; "<<getMessage();
00096 return result.str();
00097 }
00098
00099 UAPNodeException::UAPNodeException(const string& _message, UAPNode* _node)
00100 : UAPException(_message), node(_node) {}
00101
00102 UAPNodeException::UAPNodeException(const string& _message, UAPNode* _node, const UAPException& _cause)
00103 : UAPException(_message, _cause), node(_node) {}
00104
00105 UAPNodeException::~UAPNodeException() throw() {}
00106
00107 UAPNode* UAPNodeException::getNode()
00108 {
00109 return node;
00110 }
00111
00112 string UAPNodeException::toString() const
00113 {
00114 std::ostringstream result;
00115 result << "Exception: " << getMessage();
00116 if (!node)
00117 result << "\tOccured at node: " << node;
00118 return result.str();
00119 }
00120
00121 UAPParserException::UAPParserException(const string& _message)
00122 : UAPException(_message) {}
00123
00124 UAPParserException::UAPParserException(const string& _message, const UAPException& _cause)
00125 : UAPException(_message, _cause) {}
00126
00127 UAPParserException::~UAPParserException() throw() {}
00128
00129 UAPNotRecognizedException::UAPNotRecognizedException(const string& _message)
00130 : UAPParserException(_message) {}
00131
00132 UAPNotRecognizedException::UAPNotRecognizedException(const string& _message, const UAPException& _cause)
00133 : UAPParserException(_message, _cause) {}
00134
00135 UAPNotRecognizedException::~UAPNotRecognizedException() throw() {}
00136
00137 UAPBeamlineExpansionFailedException::UAPBeamlineExpansionFailedException(const string& _message)
00138 : UAPException(_message) {}
00139
00140 UAPBeamlineExpansionFailedException::UAPBeamlineExpansionFailedException(const string& _message,
00141 const UAPException& _cause)
00142 : UAPException(_message, _cause) {}
00143
00144 UAPBeamlineExpansionFailedException::~UAPBeamlineExpansionFailedException() throw() {}
00145
00146 UAPInvalidExpressionException::UAPInvalidExpressionException(const string& _message)
00147 : UAPParserException(_message) {}
00148
00149 UAPInvalidExpressionException::UAPInvalidExpressionException(const string& _message, const UAPException& _cause)
00150 : UAPParserException(_message, _cause) {}
00151
00152 UAPInvalidExpressionException::~UAPInvalidExpressionException() throw() {}
00153
00154 UAPParameterNotFoundException::UAPParameterNotFoundException(const string& _message)
00155 : UAPException(_message) {}
00156
00157 UAPParameterNotFoundException::UAPParameterNotFoundException(const string& _message,
00158 const UAPException& _cause)
00159 : UAPException(_message, _cause) {}
00160
00161 UAPParameterNotFoundException::~UAPParameterNotFoundException() throw() {}
00162
00163 UAPNotSupportedException::UAPNotSupportedException(const string& _message)
00164 : UAPException(_message) {}
00165
00166 UAPNotSupportedException::UAPNotSupportedException(const string& _message, const UAPException& _cause)
00167 : UAPException(_message, _cause) {}
00168
00169 UAPNotSupportedException::~UAPNotSupportedException() throw() {}
00170
00171 UAPFileCouldNotBeOpened::UAPFileCouldNotBeOpened(const string& _message,
00172 const string& _file, int _line)
00173 : UAPIOException(_message, _file, _line) {}
00174
00175 UAPFileCouldNotBeOpened::UAPFileCouldNotBeOpened(const string& _message,
00176 const string& _file, int _line,
00177 const UAPException& _cause)
00178 : UAPIOException(_message, _file, _line, _cause) {}
00179
00180 UAPFileCouldNotBeOpened::~UAPFileCouldNotBeOpened() throw() {}
00181
00182 UAPAttributeNotFound::UAPAttributeNotFound(const string& _message, UAPNode* _node)
00183 : UAPNodeException(_message, _node) {}
00184
00185 UAPAttributeNotFound::UAPAttributeNotFound(const string& _message, UAPNode* _node,
00186 const UAPException& _cause)
00187 : UAPNodeException(_message, _node, _cause) {}
00188
00189 UAPAttributeNotFound::~UAPAttributeNotFound() throw() {}
00190
00191 UAPAttributeConfusion::UAPAttributeConfusion(const string& _message, UAPNode* _node)
00192 : UAPNodeException(_message, _node) {}
00193
00194 UAPAttributeConfusion::UAPAttributeConfusion(const string& _message, UAPNode* _node,
00195 const UAPException& _cause)
00196 : UAPNodeException(_message, _node, _cause) {}
00197
00198 UAPAttributeConfusion::~UAPAttributeConfusion() throw() {}
00199
00200 UAPBadAttributeValue::UAPBadAttributeValue(const string& _message, UAPNode* _node)
00201 : UAPNodeException(_message, _node) {}
00202
00203 UAPBadAttributeValue::UAPBadAttributeValue(const string& _message, UAPNode* _node,
00204 const UAPException& _cause)
00205 : UAPNodeException(_message, _node, _cause) {}
00206
00207 UAPBadAttributeValue::~UAPBadAttributeValue() throw() {}
00208
00209 UAPNodeNotFound::UAPNodeNotFound(const string& _message, UAPNode* _node)
00210 : UAPNodeException(_message, _node) {}
00211
00212 UAPNodeNotFound::UAPNodeNotFound(const string& _message, UAPNode* _node,
00213 const UAPException& _cause)
00214 : UAPNodeException(_message, _node, _cause) {}
00215
00216 UAPNodeNotFound::~UAPNodeNotFound() throw() {}