chiark / gitweb /
Make BrotException properly subclass std::exception.
authorRoss Younger <onyx-commits@impropriety.org.uk>
Fri, 1 Feb 2013 20:38:34 +0000 (09:38 +1300)
committerRoss Younger <onyx-commits@impropriety.org.uk>
Fri, 1 Feb 2013 20:38:34 +0000 (09:38 +1300)
libbrot2/Exception.h

index 8af4aed..9b51066 100644 (file)
@@ -22,9 +22,9 @@
 #include <string>
 #include <iostream>
 #include <sstream>
-#include <exception>
+#include <stdexcept>
 
-struct BrotException : std::exception {
+struct BrotException : public std::exception {
        const std::string msg;
        const std::string file;
        const int line;
@@ -43,6 +43,9 @@ struct BrotException : std::exception {
        virtual operator const std::string() const {
                return detail();
        }
+       virtual const char* what() const throw() {
+               return detail().c_str();
+       }
        virtual ~BrotException() throw() {}
 };