Skip to content

Futures Library: Error

Basic future errors.

Futures / Error

Classes

Classes Description
error Class for errors in the futures library.
(class)
broken_promise The state owner got destroyed before the promise has been fulfilled.
(class)
future_already_retrieved Attempted to retrieve a unique future twice.
(class)
promise_already_satisfied Promise has already been fulfilled.
(class)
no_state There is no shared state we can access.
(class)
promise_uninitialized The promised hasn't been initialized yet.
(class)
packaged_task_uninitialized The packaged task hasn't been initialized yet.
(class)
future_uninitialized The future hasn't been initialized yet.
(class)
future_deferred Invalid operation on deferred future.
(class)

Types

Member Types Definition
future_errc Error codes for futures.
(enum)
source_location A library type equivalent to std::source_location
(using)

Functions

Member Functions Description
handle_exception Customization point to handle exceptions.
(function)
throw_exception Library function used to throw exceptions.
(function template)

Types

enum future_errc

Defined in header <futures/error.hpp>

enum class future_errc;

Enumerator Value Description
broken_promise 1 The state owner got destroyed before the promise has been fulfilled.
future_already_retrieved Attempted to retrieve a unique future twice.
promise_already_satisfied Promise has already been fulfilled.
no_state There is no shared state we can access.
promise_uninitialized The promised hasn't been initialized yet.
packaged_task_uninitialized The packaged task hasn't been initialized yet.
future_uninitialized The future hasn't been initialized yet.
future_deferred Invalid operation on deferred future.

Error codes for futures.

using source_location

Defined in header <futures/throw.hpp>

using source_location = std::source_location;

A library type equivalent to std::source_location

Description

The source_location class represents certain information about the source code, such as file names, line numbers, and function names.

See Also: std::source_location

Functions

function handle_exception

Defined in header <futures/throw.hpp>

void
handle_exception(std::exception const &, boost::source_location const &);

Customization point to handle exceptions.

Description

When exception support is disabled with [FUTURES_NO_EXCEPTIONS], this function will be called to handle exceptions.

To customize how exceptions will be handled, define the macro [FUTURES_CUSTOM_EXCEPTION_HANDLE], and define an alternative implementation for this function.

Exception Safety

Basic exception guarantee.

function throw_exception

Defined in header <futures/throw.hpp>

template <class E>
void
throw_exception(
    E && e, 
    source_location const & loc =std::source_location::current());

Library function used to throw exceptions.

Template Parameters

  • E - Exception type

Parameters

  • e - Exception object
  • loc - Location where the exception occurred

Description

This is the main library function used to throw exceptions according to the functions available for handling exceptions.

Exception Safety

Basic exception guarantee.


Updated on 2023-01-04