Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: update fetch schema failed handler (#4231)

boojack77328ae963bb
diff --git a/frontend/src/components/SchemaEditor/DatabaseTree.vue b/frontend/src/components/SchemaEditor/DatabaseTree.vue
index 016196cb5b..da857d303e 100644
--- a/frontend/src/components/SchemaEditor/DatabaseTree.vue
+++ b/frontend/src/components/SchemaEditor/DatabaseTree.vue
@@ -66,6 +66,7 @@ import {
useSchemaEditorStore,
generateUniqueTabId,
useInstanceStore,
+ useNotificationStore,
} from "@/store";
import { getHighlightHTMLByKeyWords, isDescendantOf } from "@/utils";
import { isSchemaChanged } from "./utils/schema";
@@ -614,12 +615,20 @@ const loadSubTree = async (treeNode: TreeNode) => {
}
databaseDataLoadedSet.value.add(databaseId);
- const schemaList = await editorStore.fetchSchemaListByDatabaseId(
- databaseId
- );
- if (schemaList.length === 0) {
- treeNode.children = [];
- treeNode.isLeaf = true;
+ try {
+ const schemaList = await editorStore.fetchSchemaListByDatabaseId(
+ databaseId
+ );
+ if (schemaList.length === 0) {
+ treeNode.children = [];
+ treeNode.isLeaf = true;
+ }
+ } catch (error) {
+ useNotificationStore().pushNotification({
+ module: "bytebase",
+ style: "CRITICAL",
+ title: t("schema-editor.message.failed-to-fetch-database-schema"),
+ });
}
}
};
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index 9118921a75..83200bc393 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -1490,7 +1490,8 @@
"duplicated-table-name": "Duplicated table name",
"invalid-column-name": "Invalid column name",
"duplicated-column-name": "Duplicated column name",
- "invalid-column-type": "Invalid column type"
+ "invalid-column-type": "Invalid column type",
+ "failed-to-fetch-database-schema": "Failed to fetch database schema"
},
"confirm-to-close": {
"title": "Confirm to close",
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index 49e135cf8e..666b745a24 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -1491,7 +1491,8 @@
"duplicated-table-name": "重复的表名",
"invalid-column-name": "无效的列名",
"duplicated-column-name": "重复的列名",
- "invalid-column-type": "无效的列类型"
+ "invalid-column-type": "无效的列类型",
+ "failed-to-fetch-database-schema": "请求数据库 Schema 失败"
},
"confirm-to-close": {
"title": "确定关闭?",