-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Make stacktraces available in many more cases #6299
Conversation
It appears that since the introduction of <SuperChart />, errors in the visualization javascript (which are somewhat common and expected, especially as we'll support plugins) were not handled and the whole page would throw and go missing. Here I'm introducing a new <ErrorBoundary /> component that elegantly wraps other components and handles errors. It's inspired by: https://reactjs.org/docs/error-boundaries.html The default behavior of the component is to simply surface the error as an <Alert bsStyle="danger" /> and exposes the React stacktrace when clicking on the error. It's also possible to use component and pass an onError handler and not show the default message. This also fixes some minor bugs in TimeTable.
@@ -56,6 +56,7 @@ export default function chartReducer(charts = {}, action) { | |||
[actions.CHART_RENDERING_FAILED](state) { | |||
return { ...state, | |||
chartStatus: 'failed', | |||
chartStackTrace: action.stackTrace, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should chartStackTrace
be cleared at some point? Otherwise it will be possible to have chartStatus
being successful with stale chartStackTrace
from previous failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, even though the logic of what renders is based on chartStatus
, it's a good idea to not leave expired state in Redux
Codecov Report
@@ Coverage Diff @@
## master #6299 +/- ##
==========================================
+ Coverage 77.31% 77.33% +0.01%
==========================================
Files 67 67
Lines 9575 9578 +3
==========================================
+ Hits 7403 7407 +4
+ Misses 2172 2171 -1
Continue to review full report at Codecov.
|
* Wrap <LoadableRenderer /> with <ErrorBoundary /> It appears that since the introduction of <SuperChart />, errors in the visualization javascript (which are somewhat common and expected, especially as we'll support plugins) were not handled and the whole page would throw and go missing. Here I'm introducing a new <ErrorBoundary /> component that elegantly wraps other components and handles errors. It's inspired by: https://reactjs.org/docs/error-boundaries.html The default behavior of the component is to simply surface the error as an <Alert bsStyle="danger" /> and exposes the React stacktrace when clicking on the error. It's also possible to use component and pass an onError handler and not show the default message. This also fixes some minor bugs in TimeTable. * Addressing comments * Getting more stack traces * Adressing comments
When errors occur, it's nice to have access to the stack trace in the UI. Historically some errors would show a stack trace, some wouldn't.
This PR captures many more cases where stacktraces were not captured/shown before. It builds on top of #6294 and #6220