6 #ifndef DUNE_EXCEPTIONS_HH 7 #define DUNE_EXCEPTIONS_HH 12 #include <type_traits> 97 :
public std::exception
101 void message(
const std::string &msg);
102 const char*
what()
const noexcept
override;
106 std::string _message;
183 return stream << e.
what();
216 (
requires(std::ostringstream& oss, T
t) { oss <<
t; }
217 and not std::is_integral_v<T>)
221 es.message(
es.sstream_.str());
228 (
requires(std::ostringstream& oss, T
t) { oss <<
t; }
229 and not std::is_integral_v<T>)
233 return std::move(
es);
248 es.message(
es.sstream_.str());
265 es.message(
es.sstream_.str());
277 std::ostringstream sstream_;
286 #define THROWSPEC(E) # E << " [" << __func__ << ":" << __FILE__ << ":" << __LINE__ << "]: " 314 #define DUNE_THROW(E, ...) throw Dune::ExceptionStream(E()) << THROWSPEC(E) __VA_OPT__(<<) __VA_ARGS__ std::ostream & operator<<(std::ostream &s, const bigunsignedint< k > &x)
Definition: bigunsignedint.hh:301
friend ExceptionStream & operator<<(ExceptionStream &es, std::ostream &(*t)(std::ostream &))
Stream operator for l-value ExceptionStream and io manipulator.
Definition: exceptions.hh:262
Default exception if an error in the parallel communication of the program occurred.
Definition: exceptions.hh:381
friend ExceptionStream operator<<(ExceptionStream &&es, std::ostream &(*t)(std::ostream &))
Stream operator for r-value ExceptionStream and io manipulator.
Definition: exceptions.hh:270
ExceptionStream(const E &other)
Definition: exceptions.hh:205
requires(requires(std::ostringstream &oss, T t) { oss<< t;} and not std::is_integral_v< T >) friend ExceptionStream &operator<<(ExceptionStream &es
Stream operator for l-value ExceptionStream and lvalue-reference.
static void clearHook()
remove all hooks
Definition: exceptions.cc:27
const char * what() const noexcept override
output internal message buffer
Definition: exceptions.cc:37
requires std::is_integral_v< T > friend ExceptionStream operator<<(ExceptionStream &&es, T t)
Stream operator for r-value ExceptionStream and integral values.
Definition: exceptions.hh:255
virtual ~ExceptionHook()
Definition: exceptions.hh:177
Base class for Dune-Exceptions.
Definition: exceptions.hh:96
return es
Definition: exceptions.hh:222
Default exception class for range errors.
Definition: exceptions.hh:348
Class for extending a Dune::Exception with a stream interface.
Definition: exceptions.hh:199
Dune namespace
Definition: alignedallocator.hh:12
virtual void operator()()=0
void message(const std::string &msg)
store string in internal message buffer
Definition: exceptions.cc:32
Default exception class for OS errors.
Definition: exceptions.hh:365
Default exception class for mathematical errors.
Definition: exceptions.hh:335
Exception()
Definition: exceptions.cc:16
Base class to add a hook to the Dune::Exception.
Definition: exceptions.hh:175
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:375
Default exception for dummy implementations.
Definition: exceptions.hh:357
requires std::is_integral_v< T > friend ExceptionStream & operator<<(ExceptionStream &es, T t)
Stream operator for l-value ExceptionStream and integral values.
Definition: exceptions.hh:245
Default exception class for I/O errors.
Definition: exceptions.hh:325
const T & t
Definition: exceptions.hh:219
ExceptionStream(E &&other)
Definition: exceptions.hh:209
Default exception if memory allocation fails.
Definition: exceptions.hh:370
static void registerHook(ExceptionHook *hook)
add a functor which is called before a Dune::Exception is emitted (see Dune::ExceptionHook) ...
Definition: exceptions.cc:22