pierrejeambrun opened a new pull request, #25703:
URL: https://github.com/apache/airflow/pull/25703

   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. (enhancedError, 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.enhancedError` does. (If 
you have a better way to construct an `AxiosError`, I'd be glad to take it).
   
   **Before**:
   
![image](https://user-images.githubusercontent.com/14861206/184495418-d41f0a0f-57be-4914-8fad-294ba184445c.png)
   
   **After**:
   
![image](https://user-images.githubusercontent.com/14861206/184495012-df0e7262-8bbd-4a09-852d-52cb5b07fcb9.png)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to