Skip to content

Commit

Permalink
fix: Dynamic form to connect to Snowflake DB is not displaying authen…
Browse files Browse the repository at this point in the history
…tication errors (apache#19491)

* fix: Dynamic form to connect to Snowflake DB is not displaying authentication errors

* pr comments
  • Loading branch information
diegomedina248 authored and philipher29 committed Jun 9, 2022
1 parent 3e2014d commit 673bf65
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.'),
Expand Down Expand Up @@ -930,6 +933,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
}
description={
errorAlertMapping[validationErrors?.error_type]?.description ||
validationErrors?.description ||
JSON.stringify(validationErrors)
}
showIcon
Expand Down
12 changes: 12 additions & 0 deletions superset-frontend/src/views/CRUD/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,10 @@ export function useDatabaseValidation() {
url: string;
idx: number;
};
issue_codes?: {
code?: number;
message?: string;
}[];
};
message: string;
},
Expand Down Expand Up @@ -746,6 +750,14 @@ export function useDatabaseValidation() {
),
};
}
if (extra.issue_codes?.length) {
return {
...obj,
error_type,
description: message || extra.issue_codes[0]?.message,
};
}

return obj;
},
{},
Expand Down

0 comments on commit 673bf65

Please sign in to comment.