Flow123d
JS_before_hm-1804-gf2ad740aa
|
Classes | |
class | Input::Exception |
Base of exceptions due to user input. More... | |
class | ExceptionBase |
Base of exceptions used in Flow123d. More... | |
class | StackTrace |
Class representing stacktrace of exceptions. More... | |
Macros | |
#define | DECLARE_INPUT_EXCEPTION(ExcName, Format) |
Macro for simple definition of input exceptions. More... | |
#define | THROW(whole_exception_expr) BOOST_THROW_EXCEPTION( whole_exception_expr) |
Wrapper for throw. Saves the throwing point. More... | |
#define | DECLARE_EXCEPTION(ExcName, Format) |
Macro for simple definition of exceptions. More... | |
#define | TYPEDEF_ERR_INFO(EI_Type, Type) typedef EI< struct EI_Type##_TAG, Type > EI_Type |
Macro to simplify declaration of error_info types. More... | |
#define DECLARE_EXCEPTION | ( | ExcName, | |
Format | |||
) |
Macro for simple definition of exceptions.
First parameter, ExcName
, is name of the exception class to define. Macro expands to the class derived from ExceptionBase
and implements virtual method print_info
with output given by Format
, the second parameter of the macro. This method is used by what() method to produce specific part of the error message.
You can use error info classes (see TYPEDEFERR_INFO
) and stream modifiers val
, qval
to output relevant data. Modifier val
outputs plain value, modifier qval
outputs value in quotas.
Example:
One can also pass whole classes through the exception as long as they are default constructable and copy constructable.
Example:
The example shows two ways how to call methods of the object of class Matrix passed through the exception. One can either get pointer to the object or reference. The ref
method checks that the pointer to the object is not NULL (so that the object was actually passed). The ptr
method do not perform the check. However, when using one of these methods you have to guarantee that the error_info
object is passed to the exception at every throw point that use that exception. Otherwise you get an error, meaningful in case of the ref
method, seg. fault for the ptr
method.
Currently implemented mechanism do no support standard stream modifiers, namely "endl". Please, use "\n" instead.
Definition at line 158 of file exceptions.hh.
#define DECLARE_INPUT_EXCEPTION | ( | ExcName, | |
Format | |||
) |
Macro for simple definition of input exceptions.
Works in the same way as DECLARE_EXCEPTION
, just define class derived from InputException
. Meant to be used for exceptions due to wrong input from user.
Reports input address provided through EI_Address object, see above.
Definition at line 69 of file input_exception.hh.
#define THROW | ( | whole_exception_expr | ) | BOOST_THROW_EXCEPTION( whole_exception_expr) |
Wrapper for throw. Saves the throwing point.
Macro for throwing with saving place of the throw. Just shortcut for BOOST_THROW_EXCEPTION. Creates boost kind of exception, that may accept further information through redirection.
Usage:
EI_SomeValue is an error_info
object for transfer of values form throw point to catch point. See EI<Tag,Type>
class template.
Definition at line 53 of file exceptions.hh.
#define TYPEDEF_ERR_INFO | ( | EI_Type, | |
Type | |||
) | typedef EI< struct EI_Type##_TAG, Type > EI_Type |
Macro to simplify declaration of error_info types.
Is used to declare types of data that can be passed through exceptions from the throw point to the catch point, or possibly collect various data along stack rewinding when an exception is thrown.
Typical usage:
Definition at line 194 of file exceptions.hh.