Skip to content

execution path propagation for better execution errors#304

Closed
dllx wants to merge 1 commit intographql-java:masterfrom
dllx:path-in-errors
Closed

execution path propagation for better execution errors#304
dllx wants to merge 1 commit intographql-java:masterfrom
dllx:path-in-errors

Conversation

@dllx
Copy link

@dllx dllx commented Jan 19, 2017

This patch adds execution path information to the ExceptionWhileDataFetching errors in the GraphQL result.

During execution, the path of the currently resolved/processed field is remembered and put into the ExceptionWhileDataFetching exception when an error occurs. When examining the ExecutionResult after execution is finished, each execution error can then much better be associated to the result field (which was nulled) where the error happened.

The path is in hierarchical form, with / as object field separator and with list index in square brackets, for example: field/subField[2]/subSubField

The path information is an additional field in ExceptionWhileDataFetching which can be ignored if not used. So, this patch should be backward compatible.

Note: I don't understand the Batched execution strategy, so I'm not sure if I implemented it correctly there, but I think the Simple and Executor strategy are ok.

@dminkovsky
Copy link
Contributor

dminkovsky commented Jan 20, 2017

Hi @dllx. Thank you for this!

I just wrote some comments on my async execution strategy PR that stated the need for such a path mechanism. However, I also think error handling more broadly needs to be fixed in light of #268.

And I'm not sure how to do it for all the execution strategies that are currently in the project.

What do you think?

@dllx
Copy link
Author

dllx commented Jan 23, 2017

I'm not (yet) convinced that keeping track of the path is necessary for error handling and null propagation on non-nullable fields.

I have a vague idea, but don't know if it will work out. Unfortunately, I'm rather time constrained, but will have another look when possible.

@bbakerman
Copy link
Member

I like this idea in general by the way. Being able to examine errors better is a real win.

@bsideup
Copy link
Contributor

bsideup commented Mar 2, 2017

Why not add it to the context? I use this approach ( nested contexts ) in my Reactive GraphQL - works great :)

}

private static class StringPathComponent implements PathComponent {
private final String value;
Copy link
Contributor

Choose a reason for hiding this comment

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

please expose value; it can be usable for other things like change tracking (my case)

@andimarek
Copy link
Member

@bbakerman could you have a look at this PR and how it relates to #499 ? thanks

@bbakerman
Copy link
Member

bbakerman commented Jun 18, 2017

This has now be implemented by another PR, using this one as the starting point for the work

Thanks for making this contribution

@bbakerman bbakerman closed this Jun 18, 2017
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.

5 participants