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
GH-46791: [C++] Add Status::OrElse, IntoStatus<T> and ToStatus (#46792)
### Rationale for this change
In #46711 (comment) it was mentioned that the macro `RETURN_NOT_OK_ELSE` is confusing and can easily be misunderstood. We would like a better way to conditionally chain error-handling code if a Status does not indicate success.
### What changes are included in this PR?
1. Add a type trait `IntoStatus<T>` that can be implemented to provide conversions from other error-like types
2. Add a global `ToStatus` function that calls the aforementioned type trait
3. Add a `Status::OrElse` method that calls a functor on error
4. Remove the `RETURN_NOT_OK_ELSE` macro
### Are these changes tested?
Yes.
### Are there any user-facing changes?
No, the `RETURN_NOT_OK_ELSE` was not supposed to be called by third-party code as it's not prefixed with `ARROW_`.
* GitHub Issue: #46791
Authored-by: Antoine Pitrou <antoine@python.org>
Signed-off-by: Antoine Pitrou <pitrou@free.fr>
0 commit comments