Skip to main content
function Future.block
def Future.block() -> typing.Any
function Future.catch
def Future.catch(
*types: typing.Any
) -> Future
Turn the future’s failure into a value instead of an error. block() on the returned future gives an (err, value) pair: (None, value) when it succeeds, (err, None) when it fails with an error of one of types. With no types, every failure is caught. A failure of any other type still raises, unchanged, and so does a ctx.std.process.exit in a map_ok callback. A failure raised by a runtime operation arrives as a plain error: its message is the failure, its cause chain holds the underlying reasons, and its stacktrace points at the block() call. An error value raised with fail(e) in a map_ok callback arrives as that same value. catch must be the last call before block().
function Future.map_err
def Future.map_err(callable: typing.Any) -> Future
function Future.map_ok
def Future.map_ok(callable: typing.Any) -> Future
function Future.map_ok_or_else
def Future.map_ok_or_else(
*,
map_ok: typing.Any,
map_err: typing.Any
) -> Future