Mercurial > dedupe
comparison Exception/Exception.hpp @ 73:c9447697609f
Fixed some issues with raise.
100% function code coverage for Exceptions.
| author | Tom Fredrik Blenning Klaussen <bfg@bfgconsult.no> |
|---|---|
| date | Thu, 31 Jan 2013 20:33:01 +0100 |
| parents | b2c2c2bf2bbd |
| children | 19d8825ec501 |
comparison
equal
deleted
inserted
replaced
| 72:b4185273c14a | 73:c9447697609f |
|---|---|
| 1 #ifndef EXCEPTION_HPP | 1 #ifndef EXCEPTION_HPP |
| 2 #define EXCEPTION_HPP | 2 #define EXCEPTION_HPP |
| 3 | |
| 4 #define NORETURN __attribute__ ((noreturn)) | |
| 3 | 5 |
| 4 #include <QtCore/QString> | 6 #include <QtCore/QString> |
| 5 | 7 |
| 6 class Exception { | 8 class Exception { |
| 7 | 9 |
| 10 | 12 |
| 11 virtual const string_t& toString() const | 13 virtual const string_t& toString() const |
| 12 { | 14 { |
| 13 return errorMsg_; | 15 return errorMsg_; |
| 14 } | 16 } |
| 15 void raise() const | |
| 16 { | |
| 17 throw *this; | |
| 18 } | |
| 19 | 17 |
| 18 virtual void raise() const NORETURN = 0; | |
| 20 | 19 |
| 21 protected: | 20 protected: |
| 22 Exception(const string_t& errorMsg = string_t()) : errorMsg_(errorMsg) {} | 21 Exception(const string_t& errorMsg = string_t()) : errorMsg_(errorMsg) {} |
| 23 virtual ~Exception() {} | 22 virtual ~Exception() {} |
| 24 | 23 |
