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
This commit is contained in:
Diego Medina 2022-04-05 15:11:33 -04:00 committed by GitHub
parent 1521ab3b6f
commit 634693b270
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 0 deletions

View File

@ -89,6 +89,9 @@ const engineSpecificAlertMapping = {
}; };
const errorAlertMapping = { const errorAlertMapping = {
GENERIC_DB_ENGINE_ERROR: {
message: t('Generic database engine error'),
},
CONNECTION_MISSING_PARAMETERS_ERROR: { CONNECTION_MISSING_PARAMETERS_ERROR: {
message: t('Missing Required Fields'), message: t('Missing Required Fields'),
description: t('Please complete all required fields.'), description: t('Please complete all required fields.'),
@ -929,6 +932,7 @@ const DatabaseModal: FunctionComponent<DatabaseModalProps> = ({
} }
description={ description={
errorAlertMapping[validationErrors?.error_type]?.description || errorAlertMapping[validationErrors?.error_type]?.description ||
validationErrors?.description ||
JSON.stringify(validationErrors) JSON.stringify(validationErrors)
} }
showIcon showIcon

View File

@ -689,6 +689,10 @@ export function useDatabaseValidation() {
url: string; url: string;
idx: number; idx: number;
}; };
issue_codes?: {
code?: number;
message?: string;
}[];
}; };
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; return obj;
}, },
{}, {},