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

chore(native-filters): Ensure consistent error handling #24206

Merged

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented May 24, 2023

SUMMARY

This PR ensures that the native filter components adhere to the underlying SupersetError returned by the server and render them accordingly via the ErrorMessageWithStackTrace component (which now accepts a fallback component) which provides custom overrides.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

CI, added unit tests, and manual testing. Below are examples of the ErrorMessageWithStackTrace component using an Airbnb internal custom override when users don't have access to the underlying dataset.

Before

Screenshot 2023-05-25 at 3 28 17 PM Screenshot 2023-05-25 at 3 28 27 PM

After

Screenshot 2023-05-25 at 3 29 30 PM Screenshot 2023-05-25 at 3 29 21 PM

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • 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

@john-bodley john-bodley force-pushed the john-bodley--native-filter-errors branch 3 times, most recently from f047200 to 96d717a Compare May 24, 2023 20:19
@john-bodley john-bodley marked this pull request as ready for review May 24, 2023 20:20
@john-bodley john-bodley force-pushed the john-bodley--native-filter-errors branch from 96d717a to 319a4cc Compare May 24, 2023 22:07
@john-bodley john-bodley force-pushed the john-bodley--native-filter-errors branch from 319a4cc to fc3b0fe Compare May 25, 2023 05:53
@pull-request-size pull-request-size bot added size/L and removed size/M labels May 25, 2023
@codecov
Copy link

codecov bot commented May 25, 2023

Codecov Report

Merging #24206 (93b2ea8) into master (2222073) will decrease coverage by 0.11%.
The diff coverage is 73.31%.

❗ Current head 93b2ea8 differs from pull request most recent head 18749a3. Consider uploading reports for the commit 18749a3 to get more accurate results

@@            Coverage Diff             @@
##           master   #24206      +/-   ##
==========================================
- Coverage   68.30%   68.19%   -0.11%     
==========================================
  Files        1952     1957       +5     
  Lines       75432    75592     +160     
  Branches     8191     8221      +30     
==========================================
+ Hits        51521    51553      +32     
- Misses      21807    21932     +125     
- Partials     2104     2107       +3     
Flag Coverage Δ
hive ?
javascript 54.72% <51.03%> (+0.02%) ⬆️
sqlite ?

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

Impacted Files Coverage Δ
...i-core/src/color/colorSchemes/sequential/common.ts 100.00% <ø> (ø)
...set-ui-core/src/ui-overrides/ExtensionsRegistry.ts 100.00% <ø> (ø)
...ackages/superset-ui-core/src/utils/featureFlags.ts 100.00% <ø> (ø)
...plugins/legacy-preset-chart-deckgl/src/factory.tsx 0.00% <ø> (ø)
...preset-chart-deckgl/src/layers/Heatmap/Heatmap.tsx 0.00% <0.00%> (ø)
...d/plugins/legacy-preset-chart-deckgl/src/preset.js 100.00% <ø> (ø)
superset-frontend/src/SqlLab/actions/sqlLab.js 66.66% <ø> (+0.25%) ⬆️
...d/src/SqlLab/components/SqlEditorLeftBar/index.tsx 62.12% <ø> (+0.92%) ⬆️
superset-frontend/src/SqlLab/fixtures.ts 100.00% <ø> (ø)
...et-frontend/src/SqlLab/reducers/getInitialState.js 90.62% <ø> (ø)
... and 124 more

... and 8 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member Author

@john-bodley john-bodley left a comment

Choose a reason for hiding this comment

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

Thanks for the commit @michael-s-molina. I left a couple of comments.

});
setError(
error.message || error.error || t('Check configuration'),
Copy link
Member Author

Choose a reason for hiding this comment

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

@michael-s-molina do we not need to preserve this messaging?

Copy link
Member

@michael-s-molina michael-s-molina May 25, 2023

Choose a reason for hiding this comment

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

Looking at getClientErrorObject implementation, an error is always returned and it deals with the generic case as well. In my opinion it offers a more standard treatment to the exceptions.

getClientErrorObject(error).then(parsedError => {
errorRef.current = parsedError.errors?.[0];
});
error.json().then(body => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Similar to the previous question.

@john-bodley john-bodley merged commit 674da1b into apache:master May 30, 2023
john-bodley added a commit to airbnb/superset-fork that referenced this pull request May 30, 2023
Co-authored-by: Michael S. Molina <michael.s.molina@gmail.com>
(cherry picked from commit 674da1b)
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 8, 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/L 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants