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

feat: error message for invalid variants #316

Merged
merged 8 commits into from
Mar 3, 2021

Conversation

EverlastingBugstopper
Copy link
Contributor

@EverlastingBugstopper EverlastingBugstopper commented Feb 26, 2021

fixes #208 by providing a helpful error message when trying to fetch an invalid variant

when we find a variant that's pretty close to a variant that exists in the registry:

$ rover graph fetch averys-federated-graph@whatatypoo
Fetching SDL from averys-federated-graph@whatatypoo using credentials from the default profile.
error: The graph registry does not contain variant "whatatypoo" for graph "averys-federated-graph"
        Did you mean "averys-federated-graph@whatatypo"?

when there's only one variant in the registry and the provided variant isn't similar to any of them

$ rover graph fetch averys-federated-graph@notevenclose
Fetching SDL from averys-federated-graph@dne using credentials from the default profile.
error: The graph registry does not contain variant "dne" for graph "averys-federated-graph"
        The only existing variant for graph "averys-federated-graph" is "current".

when there are only two variants in the registry and the provided variant isn't similar to any of them

$ rover graph fetch averys-federated-graph@notevenclose
Fetching SDL from averys-federated-graph@dne using credentials from the default profile.
error: The graph registry does not contain variant "dne" for graph "averys-federated-graph"
        The only existing variants for graph "averys-federated-graph" are "current" and "dev".

when there are between 3 and 10 variants in the registry and the provided variant isn't similar to any of them

$ rover graph fetch averys-federated-graph@notevenclose
Fetching SDL from averys-federated-graph@dne using credentials from the default profile.
error: The graph registry does not contain variant "dne" for graph "averys-federated-graph"
        The only existing variants for graph "averys-federated-graph" are "current", "dev", and "staging".

when there are over 10 variants in the registry

$ rover graph fetch averys-federated-graph@notevenclose
Fetching SDL from averys-federated-graph@cdahksjaksjdh using credentials from the default profile.
error: The graph registry does not contain variant "cdahksjaksjdh" for graph "averys-federated-graph"
        You can view the variants for graph "averys-federated-graph" by visiting https://studio.apollographql.com/graph/averys-federated-graph/settings

@EverlastingBugstopper EverlastingBugstopper added the feature 🎉 new commands, flags, functionality, and improved error messages label Feb 26, 2021
@EverlastingBugstopper EverlastingBugstopper added this to the March 9 milestone Feb 26, 2021
@JakeDawkins
Copy link
Contributor

I realize this definitely would've been better feedback on the issue rather than its PR, but I don't know if I like a top-level variant command. I feel like variant is an overloaded term in studio kinda, and without a clear understanding of all the possible operations on a variant, I'm not sure I really feel good about adding a variant command.

What if we added this functionality under a graph info command along with some more info that'd be useful about a graph?

I'm happy to sketch out more of this idea in that issue too :)

@EverlastingBugstopper EverlastingBugstopper changed the title feat: rover variant list feat: error message for invalid variants Mar 1, 2021
@EverlastingBugstopper EverlastingBugstopper force-pushed the avery/variant-list branch 2 times, most recently from 83cc542 to 2ea558b Compare March 1, 2021 21:19
src/error/metadata/suggestion.rs Outdated Show resolved Hide resolved
@EverlastingBugstopper
Copy link
Contributor Author

blech i force pushed something into a merge commit. gotta double make sure we squash and merge this one lol.

graph_name: String,
invalid_variant: String,
valid_variants: Vec<String>,
frontend_url_root: String,
Copy link
Contributor

Choose a reason for hiding this comment

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

Love the use of frontend_url_root 🙌

@EverlastingBugstopper EverlastingBugstopper merged commit 34c5ffe into main Mar 3, 2021
@EverlastingBugstopper EverlastingBugstopper deleted the avery/variant-list branch March 3, 2021 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🎉 new commands, flags, functionality, and improved error messages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command to list available variants
2 participants