Skip to content
Snippets Groups Projects
Commit 2c78bf88 authored by Christoph Grüninger's avatar Christoph Grüninger
Browse files

Derive Dune::Exception from std::exception.

parent 5539cdd4
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@
#ifndef DUNE_EXCEPTIONS_HH
#define DUNE_EXCEPTIONS_HH
#include <exception>
#include <string>
#include <sstream>
......@@ -88,11 +89,13 @@ namespace Dune {
\see DUNE_THROW, IOError, MathError
*/
class Exception {
class Exception
: public std::exception
{
public:
Exception ();
void message(const std::string &msg); //!< store string in internal message buffer
const std::string& what() const; //!< output internal message buffer
const char* what() const noexcept; //!< output internal message buffer
static void registerHook (ExceptionHook * hook); //!< add a functor which is called before a Dune::Exception is emitted (see Dune::ExceptionHook) \see Dune::ExceptionHook
static void clearHook (); //!< remove all hooks
private:
......@@ -196,9 +199,9 @@ namespace Dune {
_message = msg;
}
inline const std::string& Exception::what() const
inline const char* Exception::what() const noexcept
{
return _message;
return _message.data();
}
inline std::ostream& operator<<(std::ostream &stream, const Exception &e)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment