USGS

Isis 3.0 Object Programmers' Reference

Home

IException.h
Go to the documentation of this file.
1 #ifndef IException_h
2 #define IException_h
3 
27 #include <exception>
28 #include <string>
29 
30 template <typename T> class QList;
31 
32 class QString;
33 
38 #define _FILEINFO_ __FILE__,__LINE__
39 
40 namespace Isis {
41  class Pvl;
42 
99  class IException : public std::exception {
100  public:
109  /*
110  * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
111  * If at all possible do not change the enumeration values for the
112  * error codes. The reason why is it that will change the return
113  * status of error messages. Ground data processing groups (e.g.,
114  * HiRISE, LROC, Messenger) will sometime test on the error return
115  * values in their scripts. By keeping the enumerations the same
116  * we improve backward compatibility.
117  * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
118  */
119  enum ErrorType {
126  Unknown = 1,
127 
135 
155 
164  };
165 
166  IException();
167 
168  IException(ErrorType type, const char *message,
169  const char *fileName, int lineNumber);
170 
171  IException(ErrorType type, const std::string &message,
172  const char *fileName, int lineNumber);
173 
174  IException(ErrorType type, const QString &message,
175  const char *fileName, int lineNumber);
176 
177  IException(const IException &caughtException,
178  ErrorType newExceptionType, const char *message,
179  const char *fileName, int lineNumber);
180 
181  IException(const IException &caughtException,
182  ErrorType newExceptionType, const std::string &message,
183  const char *fileName, int lineNumber);
184 
185  IException(const IException &caughtException,
186  ErrorType newExceptionType, const QString &message,
187  const char *fileName, int lineNumber);
188 
189  IException(const IException &other);
190 
191  ~IException() throw();
192 
193  const char *what() const throw();
194 
195  void append(const IException &exceptionSource);
196 
197  ErrorType errorType() const;
198  void print() const;
199  void print(bool printFileInfo) const;
200  Pvl toPvl() const;
201  QString toString() const;
202  QString toString(bool printFileInfo) const;
203 
204  void swap(IException &other);
205  IException &operator=(const IException &rhs);
206 
207  private:
208  static IException createStackTrace();
209  static QString errorTypeToString(ErrorType t);
210  static ErrorType stringToErrorType(const QString &s);
211  char *buildWhat() const;
213 
214  private:
221  char * m_what;
222 
228 
233  QString * m_message;
234 
238  QString * m_fileName;
239 
244 
249  };
250 };
251 
252 #endif
253