diff --git a/localization/en.json b/localization/en.json index 8b7caed..99b80eb 100644 --- a/localization/en.json +++ b/localization/en.json @@ -154,5 +154,6 @@ "MODAL_WINDOW___DB_CONNECTIONS_LIST_TITLE": "BigQuery Connections", "MAIN_MENU___FORWARD_DB_BUCKETS": "BigQuery DDL...", "MODAL_WINDOW___FE_SCRIPT_OPTION_CREATE": "Create", - "MODAL_WINDOW___FE_SCRIPT_OPTION_UPDATE": "Alter" + "MODAL_WINDOW___FE_SCRIPT_OPTION_UPDATE": "Alter", + "PROJECT_DATASET_NOT_FOUND": "The project or dataset could not be located in the BigQuery instance.\nDouble-check the project id and dataset name. Ensure the necessary permissions are in place to access the project or dataset.\nFor further assistance, please refer to the online documentation." } diff --git a/reverse_engineering/api.js b/reverse_engineering/api.js index e0b7157..29fb4cc 100644 --- a/reverse_engineering/api.js +++ b/reverse_engineering/api.js @@ -51,8 +51,16 @@ const testConnection = async (connectionInfo, logger, cb) => { const bigQueryHelper = createBigQueryHelper(client, log); await bigQueryHelper.getDatasets(); + const datasetName = connectionInfo.datasetId || connectionInfo.data?.databaseName; + if (datasetName) { + await bigQueryHelper.getTables(datasetName); + } + cb(); } catch (err) { + if (err.code === 404) { + err.customMsgCode = 'PROJECT_DATASET_NOT_FOUND'; + } cb(prepareError(logger, err)); } }; @@ -92,6 +100,9 @@ const getDbCollectionsNames = async (connectionInfo, logger, cb, app) => { cb(null, tablesByDataset); } catch (err) { + if (err.code === 404) { + err.customMsgCode = 'PROJECT_DATASET_NOT_FOUND'; + } cb(prepareError(logger, err)); } }; @@ -456,8 +467,10 @@ const getPartitioningRange = rangePartitioning => { const prepareError = (logger, error) => { const err = { + code: error.code, message: error.message, stack: error.stack, + customMsgCode: error.customMsgCode, }; logger.log('error', err, 'Reverse Engineering error'); diff --git a/reverse_engineering/connection_settings_modal/connectionSettingsModalConfig.json b/reverse_engineering/connection_settings_modal/connectionSettingsModalConfig.json index 5c66a4b..637da4a 100644 --- a/reverse_engineering/connection_settings_modal/connectionSettingsModalConfig.json +++ b/reverse_engineering/connection_settings_modal/connectionSettingsModalConfig.json @@ -15,18 +15,18 @@ "options": [{ "value": "", "label": "Google Cloud" }] }, { - "inputLabel": "Project id", + "inputLabel": "Project ID", "inputKeyword": "projectId", "inputType": "text", "inputPlaceholder": "Optional", "inputTooltip": "Project ID on Google Cloud Platform" }, { - "inputLabel": "Dataset id", + "inputLabel": "Dataset name", "inputKeyword": "datasetId", "inputType": "text", "inputPlaceholder": "Optional", - "inputTooltip": "Dataset ID on Google Cloud Platform" + "inputTooltip": "Dataset name on Google Cloud Platform" }, { "inputLabel": "Key file",