4#ifndef DUNE_EXCEPTIONS_HH
5#define DUNE_EXCEPTIONS_HH
93 :
public std::exception
97 void message(
const std::string &msg);
98 const char*
what()
const noexcept override;
102 std::string _message;
174 virtual void operator () () = 0;
177 inline std::ostream& operator<<(std::ostream &stream,
const Exception &e)
179 return stream << e.
what();
186#define THROWSPEC(E) # E << " [" << __func__ << ":" << __FILE__ << ":" << __LINE__ << "]: "
216#define DUNE_THROW(E, m) do { E th__ex; std::ostringstream th__out; \
217 th__out << THROWSPEC(E) << m; th__ex.message(th__out.str()); throw th__ex; \
Base class for Dune-Exceptions.
Definition: exceptions.hh:94
Default exception class for I/O errors.
Definition: exceptions.hh:229
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:279
Default exception class for mathematical errors.
Definition: exceptions.hh:239
Default exception for dummy implementations.
Definition: exceptions.hh:261
Default exception if memory allocation fails.
Definition: exceptions.hh:274
Default exception if an error in the parallel communication of the program occurred.
Definition: exceptions.hh:285
Default exception class for range errors.
Definition: exceptions.hh:252
Default exception class for OS errors.
Definition: exceptions.hh:269
static void registerHook(ExceptionHook *hook)
add a functor which is called before a Dune::Exception is emitted (see Dune::ExceptionHook)
Definition: exceptions.cc:20
static void clearHook()
remove all hooks
Definition: exceptions.cc:25
void message(const std::string &msg)
store string in internal message buffer
Definition: exceptions.cc:30
const char * what() const noexcept override
output internal message buffer
Definition: exceptions.cc:35
Dune namespace.
Definition: alignedallocator.hh:11
Base class to add a hook to the Dune::Exception.
Definition: exceptions.hh:172