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: improve error message on expired token #22

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

blitz
Copy link
Contributor

@blitz blitz commented Dec 17, 2024

Slightly improve the error message when an expired token is used. Old experience:

thread 'main' panicked at src/fetch.rs:95:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Decode, source: Error("missing field `data`", line: 1, column: 40) } note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

New experience:

thread 'main' panicked at src/fetch.rs:98:13:
Request to Gitlab failed: HTTP status client error (401 Unauthorized) for url (https://gitlab.vpn.cyberus-technology.de/api/graphql) note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It's not perfect, and a better solution would be proper error handling with anyhow. But this error message would have already poked me in the right direction.

Slightly improve the error message when an expired token is used. Old experience:

thread 'main' panicked at src/fetch.rs:95:10:
called `Result::unwrap()` on an `Err` value: reqwest::Error { kind: Decode, source: Error("missing field `data`", line: 1, column: 40) }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

New experience:

thread 'main' panicked at src/fetch.rs:98:13:
Request to Gitlab failed: HTTP status client error (401 Unauthorized) for url (https://gitlab.vpn.cyberus-technology.de/api/graphql)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

It's not perfect and a better solution would be proper error handling
with anyhow. But this would have already poked me in the right
direction.
@phip1611 phip1611 self-requested a review December 17, 2024 12:56
@phip1611 phip1611 self-assigned this Dec 17, 2024
@phip1611
Copy link
Owner

Thanks for the contribution!

@phip1611 phip1611 merged commit cf24685 into phip1611:main Dec 17, 2024
13 checks passed
@phip1611 phip1611 removed their request for review December 17, 2024 12:59
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