stephenLYZ commented on code in PR #20013:
URL: https://github.com/apache/superset/pull/20013#discussion_r869378860


##########
superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx:
##########
@@ -1070,15 +1072,23 @@ const DatabaseModal: 
FunctionComponent<DatabaseModalProps> = ({
 
   // eslint-disable-next-line consistent-return
   const errorAlert = () => {
+    let alertErrors: string[] = [];
     if (isEmpty(dbErrors) === false) {
-      const message: Array<string> =
-        typeof dbErrors === 'object' ? Object.values(dbErrors) : [];
+      alertErrors = typeof dbErrors === 'object' ? Object.values(dbErrors) : 
[];
+    } else if (db?.engine === Engines.Snowflake) {
+      alertErrors =
+        validationErrors?.error_type === 'GENERIC_DB_ENGINE_ERROR'
+          ? [validationErrors?.description]
+          : [];
+    }
+
+    if (alertErrors.length) {
       return (
         <Alert
           type="error"
           css={(theme: SupersetTheme) => antDErrorAlertStyles(theme)}
           message={t('Database Creation Error')}
-          description={message?.[0] || dbErrors}
+          description={alertErrors?.[0]}

Review Comment:
   Looks like `?.` is an unnecessary logic and it's better to use `t` function 
to wrap it.



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


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

Reply via email to