You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2022/04/05 19:11:44 UTC

[superset] branch master updated: fix: Dynamic form to connect to Snowflake DB is not displaying authentication errors (#19491)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 634693b270 fix: Dynamic form to connect to Snowflake DB is not displaying authentication errors (#19491)
634693b270 is described below

commit 634693b2706e4f20479964e89da542661e9d4a77
Author: Diego Medina <di...@gmail.com>
AuthorDate: Tue Apr 5 15:11:33 2022 -0400

    fix: Dynamic form to connect to Snowflake DB is not displaying authentication errors (#19491)
    
    * fix: Dynamic form to connect to Snowflake DB is not displaying authentication errors
    
    * pr comments
---
 .../src/views/CRUD/data/database/DatabaseModal/index.tsx     |  4 ++++
 superset-frontend/src/views/CRUD/hooks.ts                    | 12 ++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
index a92d6f6440..612a566923 100644
--- a/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
+++ b/superset-frontend/src/views/CRUD/data/database/DatabaseModal/index.tsx
@@ -89,6 +89,9 @@ const engineSpecificAlertMapping = {
 };
 
 const errorAlertMapping = {
+  GENERIC_DB_ENGINE_ERROR: {
+    message: t('Generic database engine error'),
+  },
   CONNECTION_MISSING_PARAMETERS_ERROR: {
     message: t('Missing Required Fields'),
     description: t('Please complete all required fields.'),
@@ -929,6 +932,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
           }
           description={
             errorAlertMapping[validationErrors?.error_type]?.description ||
+            validationErrors?.description ||
             JSON.stringify(validationErrors)
           }
           showIcon
diff --git a/superset-frontend/src/views/CRUD/hooks.ts b/superset-frontend/src/views/CRUD/hooks.ts
index b0ca13d96a..cdb0cdc838 100644
--- a/superset-frontend/src/views/CRUD/hooks.ts
+++ b/superset-frontend/src/views/CRUD/hooks.ts
@@ -689,6 +689,10 @@ export function useDatabaseValidation() {
                           url: string;
                           idx: number;
                         };
+                        issue_codes?: {
+                          code?: number;
+                          message?: string;
+                        }[];
                       };
                       message: string;
                     },
@@ -744,6 +748,14 @@ export function useDatabaseValidation() {
                         ),
                       };
                     }
+                    if (extra.issue_codes?.length) {
+                      return {
+                        ...obj,
+                        error_type,
+                        description: message || extra.issue_codes[0]?.message,
+                      };
+                    }
+
                     return obj;
                   },
                   {},