Seastar
High performance C++ framework for concurrent servers
Public Member Functions | Public Attributes | List of all members
seastar::coroutine::exception Struct Reference

Detailed Description

Wrapper for propagating an exception directly rather than throwing it. The wrapper can be used with both co_await and co_return.

Note
It is not possible to co_return the wrapper in coroutines which return future<> due to language limitations (it's not possible to specify both return_value and return_void in the promise_type). You can use co_await instead which works in coroutines which return either future<> or future<T>.

Example usage:

co_await coroutine::exception(std::make_exception_ptr(std::runtime_error("something failed miserably")));
co_return coroutine::exception(std::make_exception_ptr(std::runtime_error("something failed miserably")));

#include <seastar/coroutine/exception.hh>

Public Member Functions

 exception (std::exception_ptr eptr) noexcept
 

Public Attributes

std::exception_ptr eptr
 

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