6#ifndef DUNE_EXCEPTIONS_HH
7#define DUNE_EXCEPTIONS_HH
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);
244 requires std::is_integral_v<T>
248 es.message(es.sstream_.str());
254 requires std::is_integral_v<T>
258 return std::move(es);
265 es.message(es.sstream_.str());
273 return std::move(es);
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
Exception()
Definition exceptions.cc:16
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
static void registerHook(ExceptionHook *hook)
add a functor which is called before a Dune::Exception is emitted (see Dune::ExceptionHook)
Definition exceptions.cc:22
friend ExceptionStream operator<<(ExceptionStream &&es, T t)
Stream operator for r-value ExceptionStream and integral values.
Definition exceptions.hh:255
friend ExceptionStream & operator<<(ExceptionStream &es, T t)
Stream operator for l-value ExceptionStream and integral values.
Definition exceptions.hh:245
static void clearHook()
remove all hooks
Definition exceptions.cc:27
friend ExceptionStream & operator<<(ExceptionStream &es, const T &t)
Stream operator for l-value ExceptionStream and lvalue-reference.
Definition exceptions.hh:218
void message(const std::string &msg)
store string in internal message buffer
Definition exceptions.cc:32
friend ExceptionStream & operator<<(ExceptionStream &es, std::ostream &(*t)(std::ostream &))
Stream operator for l-value ExceptionStream and io manipulator.
Definition exceptions.hh:262
virtual void operator()()=0
virtual ~ExceptionHook()
Definition exceptions.hh:177
const char * what() const noexcept override
output internal message buffer
Definition exceptions.cc:37
ExceptionStream(E &&other)
Definition exceptions.hh:209
Dune namespace
Definition alignedallocator.hh:13
Base class for Dune-Exceptions.
Definition exceptions.hh:98
Base class to add a hook to the Dune::Exception.
Definition exceptions.hh:176
Default exception class for I/O errors.
Definition exceptions.hh:325
Default exception class for mathematical errors.
Definition exceptions.hh:335
Default exception class for range errors.
Definition exceptions.hh:348
Default exception for dummy implementations.
Definition exceptions.hh:357
Default exception class for OS errors.
Definition exceptions.hh:365
Default exception if memory allocation fails.
Definition exceptions.hh:370
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 if an error in the parallel communication of the program occurred.
Definition exceptions.hh:381