diff options
Diffstat (limited to 'src/base/exception.h')
-rw-r--r-- | src/base/exception.h | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/src/base/exception.h b/src/base/exception.h index 01a054b19..04b155571 100644 --- a/src/base/exception.h +++ b/src/base/exception.h @@ -32,24 +32,24 @@ namespace CVC4 { class CVC4_PUBLIC Exception : public std::exception { -protected: + protected: std::string d_msg; -public: + public: // Constructors - Exception() throw() : d_msg("Unknown exception") {} - Exception(const std::string& msg) throw() : d_msg(msg) {} - Exception(const char* msg) throw() : d_msg(msg) {} + Exception() : d_msg("Unknown exception") {} + Exception(const std::string& msg) : d_msg(msg) {} + Exception(const char* msg) : d_msg(msg) {} // Destructor - virtual ~Exception() throw() {} + virtual ~Exception() {} // NON-VIRTUAL METHOD for setting and printing the error message - void setMessage(const std::string& msg) throw() { d_msg = msg; } - std::string getMessage() const throw() { return d_msg; } + void setMessage(const std::string& msg) { d_msg = msg; } + std::string getMessage() const { return d_msg; } // overridden from base class std::exception - virtual const char* what() const throw() { return d_msg.c_str(); } + const char* what() const noexcept override { return d_msg.c_str(); } /** * Get this exception as a string. Note that @@ -63,7 +63,8 @@ public: * toString(), there is no stream, so the parameters are default * and you'll get exprs and types printed using the AST language. */ - std::string toString() const throw() { + std::string toString() const + { std::stringstream ss; toStream(ss); return ss.str(); @@ -74,7 +75,7 @@ public: * a derived class, it's recommended that this method print the * type of exception before the actual message. */ - virtual void toStream(std::ostream& os) const throw() { os << d_msg; } + virtual void toStream(std::ostream& os) const { os << d_msg; } };/* class Exception */ @@ -116,8 +117,10 @@ public: static std::string formatVariadic(const char* format, ...); };/* class IllegalArgumentException */ -inline std::ostream& operator<<(std::ostream& os, const Exception& e) throw() CVC4_PUBLIC; -inline std::ostream& operator<<(std::ostream& os, const Exception& e) throw() { +inline std::ostream& operator<<(std::ostream& os, + const Exception& e) CVC4_PUBLIC; +inline std::ostream& operator<<(std::ostream& os, const Exception& e) +{ e.toStream(os); return os; } |