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

Grid, fix toast for axios errors #25703

Merged
merged 1 commit into from
Aug 13, 2022

Conversation

pierrejeambrun
Copy link
Member

@pierrejeambrun pierrejeambrun commented Aug 13, 2022

Error raised by axios (AxiosError) are not properly displayed in the toast. (Cf picture bellow).

AxiosError is a subclass of Error and therefore handled as standard Error, never reading from error.response.data but from error.message.

Added a check for Error deciding whether to read from error.message or error.response.data. (and removed the part that was never called after the Error check).

Updated the tests accordingly. Axios does not expose a way to construct AxiosError manually. (enhanceError, createError, AxiosError are not exposed because they are part of axios core). I constructed a custom object with the correct properties to be considered as an AxiosError from axios type guard (axios.isAxiosError). It is similar to what axios.enhanceError does. (If you have a better way to construct an AxiosError, I'd be glad to take it).

Before:
image

After:
image

@boring-cyborg boring-cyborg bot added area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues labels Aug 13, 2022
@bbovenzi bbovenzi merged commit 588fcc0 into apache:main Aug 13, 2022
@pierrejeambrun pierrejeambrun deleted the fix-toast-for-axios-error branch August 13, 2022 15:16
@ephraimbuddy ephraimbuddy added the type:bug-fix Changelog: Bug Fixes label Aug 15, 2022
@ephraimbuddy ephraimbuddy added this to the Airflow 2.4.0 milestone Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers. area:webserver Webserver related Issues type:bug-fix Changelog: Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants