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: Catch permission errors #2290

Merged
merged 1 commit into from
Oct 10, 2023
Merged

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Oct 9, 2023

What does this PR do?

  • Catch and explicitly log Hasura permission errors, using a toast for user feedback
  • This should never be seen, but is hopefully a helpful fallback

Demo

In the video below, I removed my platformAdmin role and unhid the "create flow" button to test what this would look like.

Screen.Recording.2023-10-09.at.20.17.36.mov

@DafyddLlyr DafyddLlyr changed the title wip: Basic toast on permission error feat(wip): Basic toast on permission error Oct 9, 2023
@github-actions
Copy link

github-actions bot commented Oct 9, 2023

Removed vultr server and associated DNS entries

@DafyddLlyr DafyddLlyr force-pushed the dp/fallback-permissions-error branch 3 times, most recently from 20d6842 to 10a0b6a Compare October 9, 2023 20:06
@DafyddLlyr DafyddLlyr force-pushed the dp/fallback-permissions-error branch from 10a0b6a to 9f57d40 Compare October 9, 2023 20:08
@DafyddLlyr DafyddLlyr changed the title feat(wip): Basic toast on permission error feat: Catch permission errors Oct 9, 2023
@@ -45,14 +48,40 @@ const publicHttpLink = createHttpLink({
headers: { "x-hasura-role": "public" },
});

const errorLink = onError(({ graphQLErrors }) => {
const handlePermissionErrors = (message: string, operation: Operation) => {
const permissionErrors = [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are a number of issues on the Hasura graphql-engine repo requesting better error messages - please see explanation here for context hasura/graphql-engine#6716 (comment)

@DafyddLlyr DafyddLlyr requested a review from a team October 9, 2023 20:19
Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

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

Looks like Vultr is still reporting global deploy delays, but code looks good here & works for me locally following same steps in your demo !

@DafyddLlyr
Copy link
Contributor Author

Looks like Vultr is still reporting global deploy delays, but code looks good here & works for me locally following same steps in your demo !

Thanks for checking that - having issue after issue with Vultr yesterday!

@DafyddLlyr DafyddLlyr marked this pull request as ready for review October 10, 2023 07:56
@DafyddLlyr DafyddLlyr merged commit 591f404 into main Oct 10, 2023
10 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/fallback-permissions-error branch October 10, 2023 07:56
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