wisc_db
wiscdb_exception.h
1 
8 #pragma once
9 
10 #include <exception>
11 #include <string>
12 
13 namespace wiscdb {
14 
18 class WiscDbException : public std::exception {
19  public:
25  explicit WiscDbException(const std::string& msg);
26 
31  virtual ~WiscDbException() throw() {}
32 
38  virtual const std::string& message() const { return message_; }
39 
45  virtual const char* what() const throw() { return message_.c_str(); }
46 
54  friend std::ostream& operator<<(std::ostream& out,
55  const WiscDbException& exception) {
56  out << exception.message();
57  return out;
58  }
59 
60  protected:
64  std::string message_;
65 };
66 
67 }
friend std::ostream & operator<<(std::ostream &out, const WiscDbException &exception)
virtual const std::string & message() const
Definition: buffer.h:14
WiscDbException(const std::string &msg)
virtual const char * what() const
Base class for all WiscDB-specific exceptions.