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

Gracefully handle validate when an unknown pack is referenced #131

Merged
merged 3 commits into from
Dec 20, 2023

Conversation

perryqh
Copy link
Contributor

@perryqh perryqh commented Dec 19, 2023

Before

thread 'main' panicked at src/packs/pack_set.rs:124:41:
/Users/perry.hertler/workspace/zenpayroll/packs/partners_api/package.yml has 'packs/tacos' in its dependencies, but that pack cannot be found. Try `packs list-packs` to debug.
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After

1 validation error(s) detected:
/Users/perry.hertler/workspace/zenpayroll/packs/partners_api/package.yml has 'packs/tacos' in its dependencies, but that pack cannot be found. Try `packs list-packs` to debug.

@@ -28,6 +28,7 @@ name = "packs"
path = "src/lib.rs"

[dependencies]
anyhow = { version = "1.0.75", features = [] } # for error handling
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're OK with bringing anyhow in, I'll follow this PR up with one that replaces the existing std::result usages

Copy link
Owner

@alexevanczuk alexevanczuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thank you! Also you'll want to bump the version when you're ready for a release, feel free to send another PR :)

Thanks for your continued work.

The new dependency looks interesting. Seems like it is a better wrapper around the error features that ship with Rust vs other solutions which attempt to rebuild error handling... looks fine to me! Would be curious to hear what you like about it in your own words :)

@alexevanczuk alexevanczuk merged commit 66e9bde into alexevanczuk:main Dec 20, 2023
5 checks passed
@perryqh
Copy link
Contributor Author

perryqh commented Dec 20, 2023

anyhow:

I really like how it infers the returned error and easily propagates errors with an optional "context". I've also noticed that some of the big names in the rust community use anyhow by default.

@perryqh perryqh deleted the ph/remove-validate-panics branch December 26, 2023 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants