mental load on programmers as ensuring that all intended errors are indeed handled
requires manual code audit.
+.. highlight:: c++
+
So, "errorator" is created. It is a wrapper around the vanilla `seastar::future`.
It addresses the performance and scalability issues while embedding the information
about all expected types-of-errors to the type-of-future.::
-
-
using ertr = crimson::errorator<crimson::ct_error::enoent,
crimson::ct_error::einval>;
and ensure signaling errors in a way that enables compile-time checking.
The most fundamental thing in an errorator is a descendant of `seastar::future`
-which can be used as e.g. function's return type:::
+which can be used as e.g. function's return type::
static ertr::future<int> foo(int bar) {
if (bar == 42) {
}
It's worth to note that returning an error that is not a part the errorator's error set
-would result in a compile-time error:::
+would result in a compile-time error::
static ertr::future<int> foo(int bar) {
// Oops, input_output_error is not allowed in `ertr`. static_assert() will
site that all these errors are handled. As the reader probably know, the main method
in `seastar::future` is `then()`. On errorated future it is available but only if errorator's
error set is empty (literally: `errorator<>::future`); otherwise callers have
-to use `safe_then()` instead:::
+to use `safe_then()` instead::
seastar::future<> baz() {
return foo(42).safe_then(
That is, handling errors removes them from errorated future's error set. This works
in the opposite direction too -- returning new errors in `safe_then()` appends them
the error set. Of course, this set must be compliant with error set in the `baz()`'s
-signature:::
+signature::
using broader_ertr = crimson::errorator<crimson::ct_error::enoent,
crimson::ct_error::einval,