Subversion Repositories public iLand

Rev

Rev 281 | Rev 639 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1
 
102 Werner 2
#ifndef EXCEPTION_H
3
#define EXCEPTION_H
121 Werner 4
#include <stdexcept>
281 werner 5
#include <QtCore/QString>
102 Werner 6
/** Exception IException is the iLand model exception class.
120 Werner 7
    The class uses a string to store exception messages.
102 Werner 8
  */
121 Werner 9
class IException : public std::runtime_error {
102 Werner 10
 public:
121 Werner 11
   ~IException () throw() {  }
12
   IException() : std::runtime_error("iLand model exception.") { }
120 Werner 13
   //IException(QString msg)  { GlobalSettings::instance()->addErrorMessage(msg); }
14
   //QString toString() const { return GlobalSettings::instance()->errorMessage(); }
121 Werner 15
   IException(QString msg) : std::runtime_error("iLand model exception.") { add(msg); }
575 werner 16
   const QString &message() const { return mMsg; }
120 Werner 17
   void add(const QString &msg) { if(!mMsg.isEmpty()) mMsg+="\n"; mMsg += msg; }
102 Werner 18
private:
120 Werner 19
   QString mMsg;
102 Werner 20
};
21
 
22
 
23
#endif // EXCEPTION_H