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

fix(auth): parse and surface returned subscription @auth errors #810

Merged
merged 1 commit into from
Oct 9, 2020

Conversation

diegocstn
Copy link
Contributor

When a subscription fails due to an authorization issue, parse and surface AppSyncJSONValue errors
in order to let DataStore recover

Issue #, if available:

Description of changes:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@diegocstn diegocstn requested a review from lawmicha October 7, 2020 16:21
@diegocstn diegocstn force-pushed the diegocstn/autherrors branch from ff07365 to a7d585e Compare October 7, 2020 16:25
@diegocstn diegocstn requested a review from wooj2 October 7, 2020 16:26
Copy link
Contributor

@wooj2 wooj2 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 we are parsing appsync errors and converting them to graphql errors so that we can expose them in the API category? Seems fine to me, but I'll defer to @lawmicha take a look.

Comment on lines +12 to +13
extension AppSyncJSONValue {
static func toJSONValue(_ json: AppSyncJSONValue) -> JSONValue {
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks good to me, i'm not sure if there's any other way around this? maybe there's a way to just decode the payload?["errors"] directly to [JSONValue.self] instead of this

@diegocstn diegocstn force-pushed the diegocstn/autherrors branch from a7d585e to 95f6aac Compare October 8, 2020 00:21
@diegocstn diegocstn marked this pull request as ready for review October 8, 2020 16:03
When a subscription fails due to an authorization issue, parse and surface AppSyncJSONValue errors
in order to let DataStore recover
@diegocstn diegocstn force-pushed the diegocstn/autherrors branch from 95f6aac to 72a0cd6 Compare October 8, 2020 23:47
@diegocstn diegocstn merged commit 36206ef into main Oct 9, 2020
@diegocstn diegocstn deleted the diegocstn/autherrors branch October 9, 2020 22:09
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.

3 participants