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

style(sqllab): make database errors more clear and render as monospace #11075

Merged
merged 6 commits into from
Oct 6, 2020

Conversation

mistercrunch
Copy link
Member

In SQL Lab, when a database error message is returned, generally because
of a user error in the SQL, it's identified as an "Unexpected Error" and
some of the text formatting of the error message (\n, spaces, tabs, ...)
are lost as they are rendered in html.

This PR identifies the error as a "Database Error", and renders like
more like a

, using a monospace font.

after

Screen Shot 2020-09-25 at 10 40 51 PM

before

Screen Shot 2020-09-25 at 10 48 27 PM

@mistercrunch
Copy link
Member Author

@rusackas, addressed your comment!

Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

Instead of passing through a prop to render the subtitle as monospace, why not wrap the subtitle in the ResultSet component and then pass it through? it's defined as a ReactNode in ErrorAlert, so you could change the typing in ErrorMessageWithStackTrace and avoid passing down the other prop. It would also help keep these error components more generic

@mistercrunch mistercrunch force-pushed the monospace_database_error branch from 1fcde95 to 70d71d7 Compare October 1, 2020 04:59
@pull-request-size pull-request-size bot added size/S and removed size/M labels Oct 1, 2020
@mistercrunch
Copy link
Member Author

@etr2460 I used your approach, thanks for the suggestion!

In SQL Lab, when a database error message is returned, generally because
of a user error in the SQL, it's identified as an "Unexpected Error" and
some of the text formatting of the error message (\n, spaces, tabs, ...)
are lost as they are rendered in html.

This PR identifies the error as a "Database Error", and renders like
more like a <pre>, using a monospace font.
@mistercrunch mistercrunch force-pushed the monospace_database_error branch from 70d71d7 to bd64825 Compare October 1, 2020 05:05
@codecov-commenter
Copy link

Codecov Report

Merging #11075 into master will decrease coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #11075      +/-   ##
==========================================
- Coverage   65.73%   65.72%   -0.01%     
==========================================
  Files         819      819              
  Lines       38865    38868       +3     
  Branches     3669     3670       +1     
==========================================
  Hits        25546    25546              
- Misses      13209    13212       +3     
  Partials      110      110              
Flag Coverage Δ
#cypress 56.33% <20.00%> (+<0.01%) ⬆️
#javascript 62.18% <50.00%> (-0.01%) ⬇️
#python 61.16% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset-frontend/src/chart/Chart.jsx 58.18% <0.00%> (ø)
superset-frontend/src/components/ErrorBoundary.jsx 50.00% <ø> (ø)
...onents/ErrorMessage/ErrorMessageWithStackTrace.tsx 27.77% <0.00%> (-1.64%) ⬇️
...erset-frontend/src/SqlLab/components/ResultSet.tsx 80.59% <75.00%> (-0.47%) ⬇️
superset/db_engine_specs/postgres.py 97.50% <0.00%> (-2.50%) ⬇️
superset/views/base_api.py 97.67% <0.00%> (-0.59%) ⬇️
...set-frontend/src/dashboard/util/getDropPosition.js 90.47% <0.00%> (ø)
...perset-frontend/src/views/CRUD/chart/ChartList.tsx 83.19% <0.00%> (+0.84%) ⬆️

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 e7a4265...bd64825. Read the comment docs.

Copy link
Member

@etr2460 etr2460 left a comment

Choose a reason for hiding this comment

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

lgtm with a couple more nits to fix

@pull-request-size pull-request-size bot added size/M and removed size/S labels Oct 2, 2020
@mistercrunch mistercrunch merged commit b2af0c0 into apache:master Oct 6, 2020
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
apache#11075)

* style(sqllab): make database errors more clear and render as monospace

In SQL Lab, when a database error message is returned, generally because
of a user error in the SQL, it's identified as an "Unexpected Error" and
some of the text formatting of the error message (\n, spaces, tabs, ...)
are lost as they are rendered in html.

This PR identifies the error as a "Database Error", and renders like
more like a <pre>, using a monospace font.

* fix the build

* addressing comments

* addressed comments

* lint + removing cruft

* addressing comments
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.0.0 labels Mar 12, 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 size/M 🚢 1.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants