Skip to content
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

Provide stack traces for runtime errors. #418

Closed
XAMPPRocky opened this issue Oct 11, 2021 · 3 comments · Fixed by #423
Closed

Provide stack traces for runtime errors. #418

XAMPPRocky opened this issue Oct 11, 2021 · 3 comments · Fixed by #423
Labels
area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc kind/feature New feature or request priority/medium Issues that we want to resolve, but don't require immediate resolution.

Comments

@XAMPPRocky
Copy link
Collaborator

Currently we use thiserror for defining errors. This is pretty good, as it has minimal boilerplate for passing up errors in the library. However when we print the errors they are currently a bit lacking in enough context to make them useful. For example; Errors do not currently print stack traces, which makes it a lot harder to debug errors at runtime, since something like RecvError(()) can happen in a lot of places.

To get these features, it would be quickest and simplest to move to a different error library. My preference would be for using eyre, but I don't know if other people feel strongly either way.

@XAMPPRocky XAMPPRocky added kind/feature New feature or request area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc priority/medium Issues that we want to resolve, but don't require immediate resolution. labels Oct 11, 2021
@markmandel
Copy link
Contributor

Just looking at thiserror - we could include backtraces by ensuring the field is part of our Error types:
https://docs.rs/thiserror/1.0.30/thiserror/#details

My concern with eyre from what I can see there is no derive macro, so we don't get to keep our own Error types (all our error types become eyre::Report)-- and having our own Error types is optimal when using Quilkin as a library.

which makes it a lot harder to debug errors at runtime, since something like RecvError(()) can happen in a lot of places.

🤔 that seems like that is not a good error? Sounds like something we should fixup so they are more explicit as well.

@markmandel
Copy link
Contributor

Just looking at thiserror - we could include backtraces by ensuring the field is part of our Error types: https://docs.rs/thiserror/1.0.30/thiserror/#details

On review, it looks like this only works with nightly Rust? 😞 Doesn't look like they are keen on incorporating https://crates.io/crates/backtrace either. 🤔

@XAMPPRocky
Copy link
Collaborator Author

XAMPPRocky commented Oct 13, 2021

My concern with eyre from what I can see there is no derive macro, so we don't get to keep our own Error types (all our error types become eyre::Report)-- and having our own Error types is optimal when using Quilkin as a library.

Sorry, I shouldn't have said move, because we'd still use thiserror for defining the error. From the eyre docs:

Eyre works with any error type that has an impl of std::error::Error, including ones defined in your crate. We do not bundle a derive(Error) macro but you can write the impls yourself or use a standalone macro like thiserror.

What would change is our return type, we'd start returning Result<T, eyre::Report>, and eyre::Report will wrap around the existing error types. It does also have the nice side benefit of removing the need for error wrapper variants (e.g. Io(std::io::Error)) since any error type can be converted into a Report, you can use ? on any Result<T, impl std::error::Error> function without having to call map_err first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/user-experience Pertaining to developers trying to use Quilkin, e.g. cli interface, configuration, etc kind/feature New feature or request priority/medium Issues that we want to resolve, but don't require immediate resolution.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants