Skip to content

fix: handle malformed API key errors#275

Merged
lrlna merged 3 commits intomainfrom
avery/406
Feb 19, 2021
Merged

fix: handle malformed API key errors#275
lrlna merged 3 commits intomainfrom
avery/406

Conversation

@EverlastingBugstopper
Copy link
Copy Markdown
Contributor

fixes #215

before:

$ rover config whoami --profile malformed-key
error: 406: Not Acceptable

after:

$ rover config whoami --profile malformed-key
error: The API key you provided is malformed. An API key must have three parts separated by a colon.
        Visit https://go.apollo.dev/r/api-keys for more details on Apollo's API keys.

serde_json::from_str(&response_text)?;

if let Some(errs) = response_body.errors {
if !errs.is_empty() && errs[0].message.contains("406") {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

😭 😭 😭

(this sounds good though)

Copy link
Copy Markdown
Member

@lrlna lrlna 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!

@lrlna lrlna merged commit 8f95a69 into main Feb 19, 2021
@lrlna lrlna deleted the avery/406 branch February 19, 2021 10:47
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.

Add error handling for 406 error

2 participants