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

cli: add basic error reporting using anyhow #25

Merged
merged 1 commit into from
Dec 17, 2024
Merged

Conversation

phip1611
Copy link
Owner

@phip1611 phip1611 commented Dec 17, 2024

Added basic error reporting. For example, the CLI might now tell you:

  • Failed to parse response body as JSON
    Caused by:
        0: error decoding response body
        1: missing field `webUrl2` at line 1 column 308
    

Closes #24

@phip1611 phip1611 self-assigned this Dec 17, 2024
@phip1611 phip1611 force-pushed the error-reporting branch 2 times, most recently from b5b11ab to e04478c Compare December 17, 2024 13:42
@blitz
Copy link
Contributor

blitz commented Dec 17, 2024

I've simplified things a bit here: blitz@443ed11

With these changes, the error message looks like this:

Error: Failed to receive response

Caused by:
    HTTP status client error (401 Unauthorized) for url (https://gitlab.vpn.cyberus-technology.de/api/graphql)

@phip1611
Copy link
Owner Author

Ah nice, thanks!

@blitz
Copy link
Contributor

blitz commented Dec 17, 2024

The history is not really useful. You can probably squash everything.

I really like the new errors!

The error is propagated to the main function. This will print
the default debug impl of the error, which is luckily already
pretty nice, in anyhow.
@phip1611 phip1611 merged commit 0396786 into main Dec 17, 2024
26 checks passed
@phip1611 phip1611 deleted the error-reporting branch December 17, 2024 15:32
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.

Feature request: proper error handling
2 participants