00001 00008 #pragma once 00009 00010 #include <exception> 00011 #include <string> 00012 00013 namespace wiscdb { 00014 00018 class WiscDbException : public std::exception { 00019 public: 00025 explicit WiscDbException(const std::string& msg); 00026 00031 virtual ~WiscDbException() throw() {} 00032 00038 virtual const std::string& message() const { return message_; } 00039 00045 virtual const char* what() const throw() { return message_.c_str(); } 00046 00054 friend std::ostream& operator<<(std::ostream& out, 00055 const WiscDbException& exception) { 00056 out << exception.message(); 00057 return out; 00058 } 00059 00060 protected: 00064 std::string message_; 00065 }; 00066 00067 }