6#ifndef DUNE_EXCEPTIONS_HH
7#define DUNE_EXCEPTIONS_HH
95 :
public std::exception
99 void message(
const std::string &msg);
100 const char*
what()
const noexcept override;
104 std::string _message;
176 virtual void operator () () = 0;
179 inline std::ostream& operator<<(std::ostream &stream,
const Exception &e)
181 return stream << e.
what();
188#define THROWSPEC(E) # E << " [" << __func__ << ":" << __FILE__ << ":" << __LINE__ << "]: "
218#define DUNE_THROW(E, m) do { E th__ex; std::ostringstream th__out; \
219 th__out << THROWSPEC(E) << m; th__ex.message(th__out.str()); throw th__ex; \
Base class for Dune-Exceptions.
Definition: exceptions.hh:96
Default exception class for I/O errors.
Definition: exceptions.hh:231
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:281
Default exception class for mathematical errors.
Definition: exceptions.hh:241
Default exception for dummy implementations.
Definition: exceptions.hh:263
Default exception if memory allocation fails.
Definition: exceptions.hh:276
Default exception if an error in the parallel communication of the program occurred.
Definition: exceptions.hh:287
Default exception class for range errors.
Definition: exceptions.hh:254
Default exception class for OS errors.
Definition: exceptions.hh:271
static void registerHook(ExceptionHook *hook)
add a functor which is called before a Dune::Exception is emitted (see Dune::ExceptionHook)
Definition: exceptions.cc:22
static void clearHook()
remove all hooks
Definition: exceptions.cc:27
void message(const std::string &msg)
store string in internal message buffer
Definition: exceptions.cc:32
const char * what() const noexcept override
output internal message buffer
Definition: exceptions.cc:37
Dune namespace.
Definition: alignedallocator.hh:13
Base class to add a hook to the Dune::Exception.
Definition: exceptions.hh:174