You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The motivation here is to flesh out the error handling path. When an error occurs it's likely that other expected functions may be called to cleanup. At the moment this would look like this:
auto delete_file = [](auto&& err) {
returndo_delete()
.error_or(err);
};
on_error is a more powerful or_else, it could conditionally turn an error into a value again. This would also be useful during error handling, perhaps as a "cleanup and try a different technique that might still fail" type function.
The text was updated successfully, but these errors were encountered:
operator-name
changed the title
Add error_or and on_error to round off functional interface
Add error_or and on_error (naming?) to round off functional interface
Sep 22, 2022
operator-name
changed the title
Add error_or and on_error (naming?) to round off functional interface
Add error_or to round off functional interface
Sep 23, 2022
error_or
would be the compliment tovalue_or
The motivation here is to flesh out the error handling path. When an error occurs it's likely that other
expected
functions may be called to cleanup. At the moment this would look like this:With
error_or
,delete_file
could look like:on_error
is a more powerfulor_else
, it could conditionally turn an error into a value again. This would also be useful during error handling, perhaps as a "cleanup and try a different technique that might still fail" type function.This is also suggested in the proposal: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2505r4.html
The text was updated successfully, but these errors were encountered: