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

Make stacktraces available in many more cases #6299

Merged
merged 4 commits into from
Nov 8, 2018

Conversation

mistercrunch
Copy link
Member

@mistercrunch mistercrunch commented Nov 8, 2018

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

9y8irexx7q

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,
Copy link
Contributor

@kristw kristw Nov 8, 2018

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.

Copy link
Member Author

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-io
Copy link

codecov-io commented Nov 8, 2018

Codecov Report

Merging #6299 into master will increase coverage by 0.01%.
The diff coverage is 66.66%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
superset/viz.py 80.47% <ø> (ø) ⬆️
superset/views/core.py 74.89% <ø> (ø) ⬆️
superset/views/api.py 94.73% <100%> (ø) ⬆️
superset/views/base.py 69.1% <60%> (+1.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ede5c71...f3a3c78. Read the comment docs.

@mistercrunch mistercrunch merged commit 4934605 into apache:master Nov 8, 2018
@mistercrunch mistercrunch deleted the error_boundary branch November 8, 2018 17:38
bipinsoniguavus pushed a commit to ThalesGroup/incubator-superset that referenced this pull request Dec 26, 2018
* 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
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0 labels Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.34.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants