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

fix: Ensure DatabaseErrorMessage works when extra is undefined #15848

Merged

Conversation

john-bodley
Copy link
Member

SUMMARY

At Airbnb we have custom error types and thus SupersetError.extra field may be undefined (or underdefined) per here whereas the DatabaseErrorMessage expects it to be well defined. This resulted in the application crashing when a custom error was thrown.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

sql-lab-error

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@@ -189,7 +197,6 @@ def __init__(self, message: str = "Request payload has incorrect format"):
message=message,
error_type=SupersetErrorType.INVALID_PAYLOAD_FORMAT_ERROR,
level=ErrorLevel.ERROR,
extra={},
Copy link
Member Author

Choose a reason for hiding this comment

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

Clean up.

@john-bodley john-bodley changed the title fix: Ensure SupersetError.extra is always a dict fix: Ensure DatabaseErrorMessage works when extra is undefined Jul 22, 2021
@john-bodley john-bodley force-pushed the john-bodley--fix-superset-error branch from 93d7469 to b561a23 Compare July 22, 2021 23:08
@pull-request-size pull-request-size bot added size/S and removed size/M labels Jul 22, 2021
@codecov
Copy link

codecov bot commented Jul 22, 2021

Codecov Report

Merging #15848 (83850a9) into master (e660de6) will decrease coverage by 0.15%.
The diff coverage is 66.66%.

❗ Current head 83850a9 differs from pull request most recent head b561a23. Consider uploading reports for the commit b561a23 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #15848      +/-   ##
==========================================
- Coverage   77.04%   76.89%   -0.16%     
==========================================
  Files         984      984              
  Lines       51787    51793       +6     
  Branches     7028     7028              
==========================================
- Hits        39901    39827      -74     
- Misses      11661    11741      +80     
  Partials      225      225              
Flag Coverage Δ
hive ?
mysql 81.53% <ø> (ø)
postgres 81.56% <ø> (+<0.01%) ⬆️
python 81.64% <ø> (-0.29%) ⬇️
sqlite 81.19% <ø> (ø)

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

Impacted Files Coverage Δ
...frontend/src/dashboard/components/Header/index.jsx 66.42% <0.00%> (-0.97%) ⬇️
superset/exceptions.py 93.18% <ø> (ø)
superset/views/base.py 75.86% <ø> (ø)
...rc/explore/components/controls/TextAreaControl.jsx 82.35% <83.33%> (-0.99%) ⬇️
...c/components/ErrorMessage/DatabaseErrorMessage.tsx 94.73% <100.00%> (ø)
superset/db_engines/hive.py 0.00% <0.00%> (-82.15%) ⬇️
superset/db_engine_specs/hive.py 69.44% <0.00%> (-17.07%) ⬇️
superset/views/database/mixins.py 81.03% <0.00%> (-1.73%) ⬇️
superset/db_engine_specs/presto.py 83.36% <0.00%> (-1.06%) ⬇️
superset/db_engine_specs/base.py 88.28% <0.00%> (-0.40%) ⬇️
... and 3 more

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 e660de6...b561a23. 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, thanks for the fix

@john-bodley john-bodley merged commit 4ba1709 into apache:master Jul 23, 2021
@john-bodley john-bodley deleted the john-bodley--fix-superset-error branch July 23, 2021 22:19
john-bodley added a commit to airbnb/superset-fork that referenced this pull request Jul 23, 2021
Co-authored-by: John Bodley <john.bodley@airbnb.com>
(cherry picked from commit 4ba1709)
cccs-RyanS pushed a commit to CybercentreCanada/superset that referenced this pull request Dec 17, 2021
Co-authored-by: John Bodley <john.bodley@airbnb.com>
QAlexBall pushed a commit to QAlexBall/superset that referenced this pull request Dec 29, 2021
Co-authored-by: John Bodley <john.bodley@airbnb.com>
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
Co-authored-by: John Bodley <john.bodley@airbnb.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.3.0 labels Mar 13, 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/S 🚢 1.3.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants