Repository navigation
exception_handling
A policy that defines how the exceptions are handled.
namespace exception_handling
{
struct none;
struct print_to_stderr;
}
Does not catch anything. This may cause exceptions from one handler to prevent other from being invoked.
Thus, it is strongly recommended to use a policy that catches and logs the exceptions.
You may either use the print_to_stderr policy or implement your own based on the log system you use.
The only reason this policy is the default one is that it does not produce any unwanted output.
A very basic logging exception policy. Prints the exception message to the stderr using fprintf.
Much safer than none, but cannot be integrated into you log system and catches std::exceptions only.
struct my_exception_handling
{
using tag = wigwag::exception_handling::tag<wigwag::api_version<2, 0>>;
template < typename Func_, typename... Args_ >
void handle_exceptions(Func_&& func, Args_&&... args) const;
};using tag = wigwag::exception_handling::tag<wigwag::api_version<2, 0>>;The policy tag. Must be a type alias for wigwag::exception_handling::tag<wigwag::api_version<2, 0>>.
template < typename Func_, typename... Args_ >
void handle_exceptions(Func_&& func, Args_&&... args) const;This method should forward args... to the func functor object and handle any exceptions that may be thrown from func.
Arguments:
- func - the function to be invoked
- args... - the function arguments that you should forward to func functor object