Migrate from failure to thiserror#1188
Conversation
|
Note that this intentionally doesn't migrate |
|
Thanks for opening a PR! However, this is typically the kind of PRs that would benefit from filling in the PR template, and even opening an issue to discuss alternatives and consider whether this is something we'd like to do. In particular, there are other crates that also handle errors, and it'd be nice to get some pros/cons for each of them. Also, changing dependencies in Code looks great and I'm very happy to see the manual |
b15c813 to
fc46b9a
Compare
|
@bnjbvr I did discuss and coordinate this with @sunfishcode before submitting it, and filed an issue at bytecodealliance/wasmtime#436 to discuss as well before starting this work. A bit more on thiserror vs failure: thiserror has fewer dependencies than failure_derive. thiserror uses the standard Thus, I'd suggest that thiserror has the minimum possible impact on users of cranelift. I hope that there's no further churn in error-handling conventions in the community, but on the off chance there is, I think that it'd be entirely transparent to the users of cranelift, and could be done without in any way breaking the cranelift ABI. |
|
I wasn't aware of the wasmtime issue, fair enough. That being said, this doesn't tell anything about other crates implementing the same behavior. In particular, it seems |
|
err-derive's approach to thiserror has fewer dependencies than either err-derive or failure_derive. thiserror does have plans to handle |
The failure crate invents its own traits that don't use std::error::Error (because failure predates certain features added to Error); this prevents using ? on an error from failure in a function using Error. The thiserror crate integrates with the standard Error trait instead.
This will also improve reporting of the chain of errors.
fc46b9a to
0e8571e
Compare
|
Thanks for the review and the merge, @bnjbvr and @sunfishcode! A quick note: sorry for not using the pull request template for this PR. I didn't see it, as I don't typically submit pull requests via the github web interface. I use Thanks again for your patience and review. |
Ah, that explains the lack of context here. Your answers definitely cleared up all my questions, so I appreciate you taking the time providing them. |
The failure crate invents its own traits that don't use
std::error::Error (because failure predates certain features added to
Error); this prevents using ? on an error from failure in a function
using Error. The thiserror crate integrates with the standard Error
trait instead.