ktmud commented on a change in pull request #11618:
URL: 
https://github.com/apache/incubator-superset/pull/11618#discussion_r522390741



##########
File path: superset-frontend/src/views/CRUD/data/database/DatabaseModal.tsx
##########
@@ -175,7 +175,13 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> 
= ({
       .catch(response =>
         getClientErrorObject(response).then(error => {
           addDangerToast(
-            t('ERROR: Connection failed. ') + error?.message || '',
+            error?.message
+              ? `${t('ERROR: ')}${
+                  typeof error.message === 'string'
+                    ? error.message
+                    : (error.message as Record<string, 
string[]>).sqlalchemy_uri

Review comment:
       The API sometimes has `message` being a dictionary of validation errors 
by field name, but the frontend is not able to handle that. This is just a 
one-off stop-gap fix which is not very scalable.
   
   We should do a larger refactor to either explode the validation errors as 
multiple Error objects from the server side, handle them within 
`getClientErrorObject`, or more preferably, in `superset-ui/core`'s `makeApi`.
   
   I'll add this to my todo but if anyone will be working on this area soon, 
feel free to take over.
   
   cc @etr2460 since you've been working on client-side error messages.




----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to