Async++ unknown
Async (co_await/co_return) code for C++
Loading...
Searching...
No Matches
asyncpp::exception_policy Struct Reference

Exception policy for e.g. fire and forget tasks. More...

#include <asyncpp/policy.h>

Static Public Member Functions

static exception_policy handle (std::function< void()> cbfn)
 Call the specified method on exception. The callback is called within the catch block.
 

Public Attributes

std::function< void()> handler
 Handler method to invoke if an exception is thrown.
 

Static Public Attributes

static const exception_policy terminate = {[]() { std::terminate(); }}
 The default terminate handler. Calls std::terminate() and usually ends the program.
 
static const exception_policy ignore = {}
 Noop that ignores the thrown exception. The coroutine ends at the throw point and the stack frame is destroyed.
 

Detailed Description

Exception policy for e.g. fire and forget tasks.

Allows changing the default terminate call if an exception leaves the async function and calls the specified handler instead. It can be used by awaiting the object in supported task types.

static const exception_policy ignore
Noop that ignores the thrown exception. The coroutine ends at the throw point and the stack frame is ...
Definition policy.h:23

The documentation for this struct was generated from the following file: