comparison Exception.hpp @ 9:b5943e4bf676

Fix up header includes. Introduce outer catch. Fix coding style. Remove spurious debug output.
author Tom Fredrik Blenning Klaussen <bfg@blenning.no>
date Wed, 22 Aug 2012 18:48:07 +0200
parents d7b384b4a834
children 06166d6c083b
comparison
equal deleted inserted replaced
8:d7b384b4a834 9:b5943e4bf676
4 #include <QtCore/QString> 4 #include <QtCore/QString>
5 5
6 class Exception { 6 class Exception {
7 7
8 public: 8 public:
9 virtual QString toString() const 9 typedef QString string_t;
10
11 virtual const string_t& toString() const
10 { 12 {
11 return errorMsg_; 13 return errorMsg_;
12 } 14 }
13 void raise() const 15 void raise() const
14 { 16 {
15 throw *this; 17 throw *this;
16 } 18 }
17 19
18 20
19 protected: 21 protected:
20 Exception(const QString& errorMsg) : errorMsg_(errorMsg) {} 22 Exception(const string_t& errorMsg) : errorMsg_(errorMsg) {}
21 virtual ~Exception() {} 23 virtual ~Exception() {}
22 24
23 void setErrorMsg(QString& errorMsg); 25 void setErrorMsg(string_t& errorMsg);
24 const QString& errorMsg(QString& errorMsg); 26 const string_t& errorMsg(string_t& errorMsg);
25 27
26 private: 28 private:
27 QString errorMsg_; 29 string_t errorMsg_;
28 }; 30 };
29 31
30 #endif //EXCEPTION_HPP 32 #endif //EXCEPTION_HPP