-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Run error presenter in context during unmarshal #1305
Closed
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lwc
added a commit
that referenced
this pull request
Aug 28, 2020
This is an alternative to #1305 that leans into error wrapping instead of away from it. Requires use of go 1.13 error unwrapping. On measure I think I prefer this approach, even though it's a bigger BC break: - There's less mutex juggling - It has never felt right to me that we make the user deal with path when overriding the error presenter - The default error presenter is now incredibly simple Questions: - Are we comfortable with supporting 1.13 and up? - Should we change the signature of `ErrorPresenterFunc` to `func(ctx context.Context, err *gqlerror.Error) *gqlerror.Error`? - It always is now, and breaking BC will force users to address the requirement for `errors.As`
lwc
added a commit
that referenced
this pull request
Aug 28, 2020
This is an alternative to #1305 that leans into error wrapping instead of away from it. Requires use of go 1.13 error unwrapping. On measure I think I prefer this approach, even though it's a bigger BC break: - There's less mutex juggling - It has never felt right to me that we make the user deal with path when overriding the error presenter - The default error presenter is now incredibly simple Questions: - Are we comfortable with supporting 1.13 and up? - Should we change the signature of `ErrorPresenterFunc` to `func(ctx context.Context, err *gqlerror.Error) *gqlerror.Error`? - It always is now, and breaking BC will force users to address the requirement for `errors.As`
lwc
added a commit
that referenced
this pull request
Aug 28, 2020
This is an alternative to #1305 that leans into error wrapping instead of away from it. Requires use of go 1.13 error unwrapping. On measure I think I prefer this approach, even though it's a bigger BC break: - There's less mutex juggling - It has never felt right to me that we make the user deal with path when overriding the error presenter - The default error presenter is now incredibly simple Questions: - Are we comfortable with supporting 1.13 and up? - Should we change the signature of `ErrorPresenterFunc` to `func(ctx context.Context, err *gqlerror.Error) *gqlerror.Error`? - It always is now, and breaking BC will force users to address the requirement for `errors.As`
lwc
added a commit
that referenced
this pull request
Aug 28, 2020
This is an alternative to #1305 that leans into error wrapping instead of away from it. Requires use of go 1.13 error unwrapping. On measure I think I prefer this approach, even though it's a bigger BC break: - There's less mutex juggling - It has never felt right to me that we make the user deal with path when overriding the error presenter - The default error presenter is now incredibly simple Questions: - Are we comfortable with supporting 1.13 and up? - Should we change the signature of `ErrorPresenterFunc` to `func(ctx context.Context, err *gqlerror.Error) *gqlerror.Error`? - It always is now, and breaking BC will force users to address the requirement for `errors.As`
lwc
added a commit
that referenced
this pull request
Aug 28, 2020
This is an alternative to #1305 that leans into error wrapping instead of away from it. Requires use of go 1.13 error unwrapping. On measure I think I prefer this approach, even though it's a bigger BC break: - There's less mutex juggling - It has never felt right to me that we make the user deal with path when overriding the error presenter - The default error presenter is now incredibly simple Questions: - Are we comfortable with supporting 1.13 and up? - Should we change the signature of `ErrorPresenterFunc` to `func(ctx context.Context, err *gqlerror.Error) *gqlerror.Error`? - It always is now, and breaking BC will force users to address the requirement for `errors.As`
lwc
added a commit
that referenced
this pull request
Aug 28, 2020
This is an alternative to #1305 that leans into error wrapping instead of away from it. Requires use of go 1.13 error unwrapping. On measure I think I prefer this approach, even though it's a bigger BC break: - There's less mutex juggling - It has never felt right to me that we make the user deal with path when overriding the error presenter - The default error presenter is now incredibly simple Questions: - Are we comfortable with supporting 1.13 and up? - Should we change the signature of `ErrorPresenterFunc` to `func(ctx context.Context, err *gqlerror.Error) *gqlerror.Error`? - It always is now, and breaking BC will force users to address the requirement for `errors.As`
lwc
added a commit
that referenced
this pull request
Sep 17, 2020
This is an alternative to #1305 that leans into error wrapping instead of away from it. Requires use of go 1.13 error unwrapping. On measure I think I prefer this approach, even though it's a bigger BC break: - There's less mutex juggling - It has never felt right to me that we make the user deal with path when overriding the error presenter - The default error presenter is now incredibly simple Questions: - Are we comfortable with supporting 1.13 and up? - Should we change the signature of `ErrorPresenterFunc` to `func(ctx context.Context, err *gqlerror.Error) *gqlerror.Error`? - It always is now, and breaking BC will force users to address the requirement for `errors.As`
lwc
added a commit
that referenced
this pull request
Sep 17, 2020
This is an alternative to #1305 that leans into error wrapping instead of away from it. Requires use of go 1.13 error unwrapping. On measure I think I prefer this approach, even though it's a bigger BC break: - There's less mutex juggling - It has never felt right to me that we make the user deal with path when overriding the error presenter - The default error presenter is now incredibly simple Questions: - Are we comfortable with supporting 1.13 and up? - Should we change the signature of `ErrorPresenterFunc` to `func(ctx context.Context, err *gqlerror.Error) *gqlerror.Error`? - It always is now, and breaking BC will force users to address the requirement for `errors.As`
cgxxv
pushed a commit
to cgxxv/gqlgen
that referenced
this pull request
Mar 25, 2022
This is an alternative to 99designs#1305 that leans into error wrapping instead of away from it. Requires use of go 1.13 error unwrapping. On measure I think I prefer this approach, even though it's a bigger BC break: - There's less mutex juggling - It has never felt right to me that we make the user deal with path when overriding the error presenter - The default error presenter is now incredibly simple Questions: - Are we comfortable with supporting 1.13 and up? - Should we change the signature of `ErrorPresenterFunc` to `func(ctx context.Context, err *gqlerror.Error) *gqlerror.Error`? - It always is now, and breaking BC will force users to address the requirement for `errors.As`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WrapErrorWithInputPath
introduced in #1115 causes input error types to be clobbered (#1291).My original fix was going to be to resurrect #1263 and push forward with go 1.13 errors, but when I was taking stock of the error flows for marshal and unmarshal cases, I noticed how asymmetrical they are.
Errors during marshal call the execution context in scope and with all necessary context, whereas errors during unmarshal flow back up the call stack and are handled at fairly high levels after a bunch of context is lost.
This patch is an attempt to bring the unmarshal flow more in line with the marshal flow, removing the need to wrap errors to attach the extra context.
Errors are still used as flow control back up the stack though, so we need to avoid over reporting errors by checking if children have errored, this isn't super elegant.
#1115 also introduced
FieldInputContext
separate fromFieldContext
, which invalidates some existing assumptions about how to extract the gql path from context.GetPathFromContext
is introduced to smooth over the difference, prioritising the input context when both are present.The default error presenter is updated to use this new path source, but custom error presenters will need to be updated.
Alternatives / thoughts / questions
FieldInputContext
be separate fromFieldContext
? A single type with some sparse properties might provide better BCFixes: #1291
I have: