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
[superset-client] use getClientErrorObject for client error handling #6163
Conversation
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.
a few nits. overall LGTM
}); | ||
}); | ||
|
||
it('Handles Repsonse that can be parsed as json', () => { |
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.
typo Response
}); | ||
}); | ||
|
||
it('Handles Repsonse that can be parsed as text', () => { |
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.
another typo
🤮 build is stuck ... will give it a bit more time to sort itself out. |
Need to merge #6133 before this one |
@williaster I wanted to add this into If it's not easy maybe I just need to cut |
Hmm, it would probably need all of SupersetClient PRs because it may have been introduced in one of the earlier ones. they were #5875 chart ajax (introduced bug?) unsure, |
I think |
…pache#6163) * [superset-client] use getClientErrorObject for client error handling * fix getClientErrorObject json parsing * fix getClientErrorObject test typos * kick build (cherry picked from commit d8d50a1)
…pache#6163) * [superset-client] use getClientErrorObject for client error handling * fix getClientErrorObject json parsing * fix getClientErrorObject test typos * kick build
This PR fixes #6152 and is a more generic fix than #6158 for handling fetch-based errors.
It adds a method
getClientErrorObject
which takes a fetchResponse
as input, reads it as eitherjson
ortext
, and returns aPromise
that resolves to an object with all keys from theResponse
and anerror
key which can be used for display in the UI.Note this is more complex than previous
ajax
errors because we must read the response explicitly, and because of the mixture of response types we have no idea if it's text or json.Added unit tests and tested locally for bug reported in #6152
@mistercrunch @graceguo-supercat @kristw @michellethomas