-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move from error-chain
to thiserror
for error management
#8
Comments
Thank you for this suggestion. I need more input before I make a decision. You argue that That being said, after a quick glance at Still, I'm a bit uncomfortable with investing in a crate whose ambition is to deprecate a trait from the standard lib. Especially when some of the complains about the standard trait have been fixed in the meantime. In that respect, the Evolution section in their README is not really clear, but it makes me nervous. So, could you please elaborate more why you think |
As you said, The other advantage is that the conversion traits make it easier to use |
But the
It seems that you solved this problem in your latest commit f6eb5fe. Or is it something else? As you can see, I'm still reluctant to make the leap. But I'm also still open to discussion. |
The difference is that to do that with Furthermore, as seen in my PR, there is ambiguity between chaining and wrapping the error: in Ultimately, both libraries are doing the same thing, but |
actually, you would use
I'm not sure about that. Explicit is better than implicit, and chaining an error is not the same as converting it...
Granted. But in the case of
Yes, but I agree that |
I just discovered |
Now you're talking :-D |
error-chain
to failure
for error managementerror-chain
to err-derive
for error management
When talking about alternative error handling crates, I would also consider snafu. It uses the |
Thanks @MattesWhite, I'll also have a look. |
error-chain
to err-derive
for error managementerror-chain
to err-derive
of snafu
for error management
When talking about error-handling, what about the I can definetly see its use-case and the performance it could bring and I can understand that you want to use it as it was probably your first crate in Rust. But, it feels very unergonomic and produces a lot of noise. In addition, I think its performance boost is not as much as one might guess. A correctly designed error-enum should have not more than 24 bytes (two pointers and an extra 64 bit field on a 64-bit-machine). This shouldn't affect the overall memory requirement of an RDF-application. In order to handle errors in an public API, it is totally okay to go with An alternative would be using an own error-enum like: use thiserror:Error as ThisError;
#[derive(ThisError, Debug)]
enum Error {
... ,
#[error(External Error: {0})]
FromExtern(String),
}
impl Error {
from_external<E: std::error::Error>(e: E) -> Self {
Error::FromExternal(e.to_string())
}
} This way every implementor of a custom graph, parser, etc. could |
Actually,
Does it? It pains we that you would think that, I spent quite some time to try and make it ergonomic...
I cant deny that :-/ But most of the time, users would not be required to directly use it (the most verbose part are in trait methods with a default implementation). I agree that |
Sorry for that I don't wanted to be offensive. In addition, I removed my PR #27 as I have to admitt that this way was to aggresive and without a proper discussion... I deeply appologize for my inappropriate behavior. |
As I still agree that my PR #27 was not good, I still use it as a proof of concept. Cons of the current error handlingThe main point I wanted to lay out was the seperation of errors. Instead of having one big As laid out in #26 the plan is to build an ecosystem of crates that implement against The philosophy of Pros presented in #27In difference, I showed an implementation of sophia with the rather new crates
The Furthermore, users will know which errors colide ("I use the Another point is the weight of zero-cost error-handling. While it is true that ConclusionWhile it is true that in some cases What is your opinion about that? I would be glad if we could continue this discussion. If we can agree on an implementation I will gladly submit a PR. |
No offense taken, don't worry :-)
Now, regarding I had a look at I have more doubts about Alternative to
|
Thought: I think the smoothest way to contribute to this issue would be to keep the global The first module to patch would probably be the |
Great! The I would only name enum StreamError<SErr, TErr> {
Source { source: SErr },
Target { source: TErr },
} This way it is more obvious if a error was raised by the Another candidate that came into my mind is the When I have some time I would write a PR if it's okay for you. |
I moved the
Be my guest :-) Do you mind if I assign those issues to you? |
According to pchampin#8 `coercible-errors` is not suitable for the future seperation of sophia. Therefore, it was replaced by `StreamError` where sensible. In addition, `coercoble_errors::Never` was replaced by `std::convert::Infallible`. It is a first step towards the stabilization of Rust's `Never`-type. Resolves: pchampin#28
error-chain
to err-derive
of snafu
for error managementerror-chain
to thiserror
for error management
Hi!
error-chain
is not maintained anymore, so it would be a good idea to move tofailure
, which has all the features needed already, as well as backtrace support (i.e. the underlyingpest
error could be accessed from aParserError
using thecause()
method).The text was updated successfully, but these errors were encountered: