piranha
0.10
|
Exceptions. More...
#include <stdexcept>
#include <string>
#include <type_traits>
#include <utility>
#include <piranha/type_traits.hpp>
Go to the source code of this file.
Classes | |
struct | piranha::not_implemented_error |
Exception for functionality not implemented or not available on the current platform. More... | |
struct | piranha::zero_division_error |
Exception for signalling division by zero. More... | |
Namespaces | |
piranha | |
Root piranha namespace. | |
Macros | |
#define | piranha_throw(exception_type, ...) piranha::ex_thrower<exception_type>(__FILE__, __LINE__, __func__)(__VA_ARGS__) |
Exception-throwing macro. More... | |
Exceptions.
This header contains custom exceptions used within piranha and related utilities.
Definition in file exceptions.hpp.
#define piranha_throw | ( | exception_type, | |
... | |||
) | piranha::ex_thrower<exception_type>(__FILE__, __LINE__, __func__)(__VA_ARGS__) |
Exception-throwing macro.
By default, this variadic macro will throw an exception of type exception_type
, using the variadic arguments for the construction of the exception object. The macro will check if the exception can be constructed from the variadic arguments, and will produce a compilation error in case no suitable constructor is found.
Additionally, given a set of variadic arguments [arg0,arg1,...]
, and
arg0
can be concatenated to an std::string
via the +=
operator,[str,arg1,...]
, where str
is an instance of std::string
,then the first argument arg0
is interpreted as the error message associated to the exception object, and it will be decorated with information about the context in which the exception was thrown (file, line, function) before being passed on for construction.
Note that, in order to be fully standard-compliant, for use with exceptions that take no arguments on construction the invocation must include a closing comma. E.g.,
is not correct, whereas
is correct.
exception_type | the type of the exception to be thrown. |
Definition at line 118 of file exceptions.hpp.