X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2FMoof%2FError.hh;h=c452ae6df836f8351660b5cd0e460239f1932697;hb=81ff940d1bea07447f8218ab9a764fbf393431e8;hp=86b8a120bdb1b0635153a8a2190d0e3e1b13ad32;hpb=4f62ce947db282f0bbf4d49b3aafb83d7cf51adc;p=chaz%2Fyoink diff --git a/src/Moof/Error.hh b/src/Moof/Error.hh index 86b8a12..c452ae6 100644 --- a/src/Moof/Error.hh +++ b/src/Moof/Error.hh @@ -57,7 +57,7 @@ public: UNKNOWN_IMAGE_FORMAT, // name of resource }; - explicit Error(unsigned code, const std::string& what = "") + explicit Error(unsigned code = NONE, const std::string& what = "") { init(code, what); } @@ -70,7 +70,7 @@ public: mCode = code; } - virtual void raise() + virtual void raise() const { throw *this; } @@ -85,11 +85,18 @@ public: return mWhat; } - bool isError() const throw() + operator bool () const { + // resolves to true if error code is not NONE return mCode != NONE; } + void reset() throw() + { + mCode = NONE; + mWhat[0] = '\0'; + } + private: unsigned mCode;