Chained errors with contextual info in layers #4856
Merged
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.
This PR improves the error reporting when errors occur during evaluations of a layer. It also adds an improvement to all errors in ggproto methods since the methods are now called by name so we avoid the useless
Error in f()
we get now.The new look of layer errors is:
which is a mouthful but a huge improvement in terms of letting the user understand how their code is wrong
The remaining question is if this error chaining should be expanded to other ggproto objects in play during plot rendering. I feel it is less imperative than the layer errors because facets and coords are singular in the plot and they are thus less likely to cause confusion as to where the error occurred. I'm however open to expanding the
try_fetch
implementations inggplot_build()
to cover it all