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
I would like to refactor the errors crate to use the thiserror crate. The patterns implemented in the module are very similar to the crate. The crate is widely used in rust libs. I think it would probably raise the quality of the code a bit to use the crate. Would this be an interesting change?
The text was updated successfully, but these errors were encountered:
If you want to use it just for defining error messages via derive macro then I think this is unnecessary. My points are:
thiserror requires rust 1.56+, we require rust 1.52+. While I generally not against raising required version, that change also should give significant improvements
overhead from manually implementing necessary traits are minimal
new dependency increases build time. That is fine if it gives us new abilities but I prefer to avoid that if not
If you like also rework our errors to make them more ergonomic, then I'm not against. Actually, we should do that, some of our errors are cryptic. I also would like to have backtraces in our errors, but I'm unsure should we do something special to give them or we can get them automatically. Rust books is not clear about that.
The other thing that we lack in our errors is a position information (there is a dedicated issue for this -- #625). I would like to learn approaches used in other serde format libraries.
This all sounds reasonable. I do think that thiserror is a good path
forward. I think it might help with making the errors more ergonomic, which
is part of my intent.
wt
added a commit
to wt/quick-xml
that referenced
this issue
Aug 27, 2023
The thiserror crate takes care of a bunch of details of implementing
errors for a library in rust. This will simplify the code around our
errors by making it follow conventions that are widely used in the rust
community. It also is much shorter in terms of lines of code.
Closestafia#638
wt
linked a pull request
Aug 27, 2023
that will
close
this issue
I would like to refactor the errors crate to use the thiserror crate. The patterns implemented in the module are very similar to the crate. The crate is widely used in rust libs. I think it would probably raise the quality of the code a bit to use the crate. Would this be an interesting change?
The text was updated successfully, but these errors were encountered: