-
Notifications
You must be signed in to change notification settings - Fork 138
Towards 0.2 and Beyond #287
Comments
Just for the record, this is probably related: https://users.rust-lang.org/t/announcing-err-derive-yet-another-error-handling-library/23594
|
To be honest it's not very hard to come up with something better than failure soon given the pending changes to the stdlib. Once backtraces work I hope we will find a good path for failure and std error to converge. |
Well, I think this issue is good news! The only thing that concerns me is
Does this also apply to the derive macro? I'm wondering whether it still makes sense to work on |
@torkleyy Apologies for the delay. Yes, I think this should also apply to the derive macro. |
Related to this:
I kind of feel there's a demand (is that the right word?) for something like failure::Error + derive, but on top of |
I think it’ll be okay to release a 0.2 without support for backtraces in std. At the very latest, I’d like to release Failure 0.2 before 1.33, which is February 28th, if I recall correctly. This allows for a coherent story around error-handling either regard to |
With regard to deriving Error, I agree about the minimization of fragmentation ecosystem-wide. As a single data point, @sapessi ran into a lot of issues with the current Fail derive in the AWS Lambda Runtime and replacing it with an Error derive would make things easier for library authors implementing error extensions, never-mind end users. (sorry for not editing this comment more clearly; I’m short on time this afternoon and want to get my thoughts out.) |
What would this mean for |
@davidbarsky If error handling is expressed as a graph, I currently use Failure's I don't feel the name For example: I think something like |
@yoshuawuyts I responded to your comment on: #296 (comment)! |
I ran into some roadblocks with the backtrace for std but I will try to get this done now. However I think failure in the meantime evolved a bit and there is probably more we would need on the stdlib error. In particular the |
Hello Is there any progress? Is there anything people could do to help it move forward, or is it blocked on something external? |
@vorner I haven't had the time to work on this, I'm sorry—a lot of life happened. This is something that others can/should pick up, as I think the initial issue described a path forward for the implementation. Additionally, with the stabilization of core::any::type_name in 1.38, I think that the |
Hmm. I have quite a long queue of things I want to write myself, but maybe I could get to it sooner than you. No promises yet, though. |
With most of RFC 2504 being implemented in stable, I wanted to share my idea of how Failure should evolve towards. For preserving context, I'll briefly re-iterate what RFC 2504 entails:
Error::cause
is being replaced byError::source
in Rust 1.33, which supports downcasting of inner errors.std::error::Error
requires a Display and Debug, which provides a string-based representation of the error.std
provides a Backtrace module, which provides a minimal API for just printing a backtrace for end-users. This is not implemented yet, but @mitsuhiko indicated on December 28th, 2018 that he's working on the Backtrace implementation forstd
1.As @withoutboats indicated in RFC 2504, the
Fail
trait in Failure would become an extension trait tostd:error::Error
along the lines of:The Failure crate would then provide a derive for the standard library's error akin to:
This new derive will be introduced in Failure 0.2. The corresponding derive of
Fail
can be removed with the release of 0.2, or more conservatively, marked as deprecated and removed entirely in Failure 0.3. The release of Failure 0.2 will come with a corresponding minimum Rust version bump to at least 1.31.Additionally, while the following are not strictly bound to the release of Failure 0.2, we can also provide:
Additionally, with Rust's increasing use in the network services space, a pain point that's emerged is best practices around error reporting to instrumentation systems. While the
type_name
intrinsic would be a great solution for this problem , it's currently nightly-only and blocked on specialization. Failure could patch this gap by introducing an associatedconst ERROR_TYPE: &'static str
toErrorExt
for error-reporting purposes. This const can subsequently be removed and deprecated once specialization is available.Feedback on this proposal is welcome and encouraged.
[1]: See the rust-lang Discord, the general channel. Relevant conversation reproduced below:
The text was updated successfully, but these errors were encountered: