Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: error handling (#6868)
Liu Ji8880e2d5583c
diff --git a/frontend/src/components/Issue/IssueTaskStatementPanel.vue b/frontend/src/components/Issue/IssueTaskStatementPanel.vueindex d4235178eb..c84c88601e 100644--- a/frontend/src/components/Issue/IssueTaskStatementPanel.vue+++ b/frontend/src/components/Issue/IssueTaskStatementPanel.vue@@ -508,42 +508,46 @@ const handleUploadFile = async (event: Event, tick: (p: number) => void) => {return;}- state.isUploadingFile = true;const projectName = selectedDatabase.value.project;- const { filename, content: statement } = await handleUploadFileEvent(- event,- 100- );- const uploadStatementAsSheet = async (statement: string) => {- let payload = {};- if (!create.value) {- payload = getBacktracePayloadWithIssue(issue.value as Issue);- }- // TODO: upload process- const sheet = await sheetV1Store.createSheet(projectName, {- title: filename,- content: new TextEncoder().encode(statement),- visibility: Sheet_Visibility.VISIBILITY_PROJECT,- source: Sheet_Source.SOURCE_BYTEBASE_ARTIFACT,- type: Sheet_Type.TYPE_SQL,- payload: JSON.stringify(payload),- });- state.isUploadingFile = false;+ const uploadStatementAsSheet = async () => {+ state.isUploadingFile = true;+ try {+ const { filename, content: statement } = await handleUploadFileEvent(+ event,+ 100+ );- resetTempEditState();- updateSheetId(sheetV1Store.getSheetUid(sheet.name));- await updateStatement(statement);- state.editing = false;- if (selectedTask.value) {- updateEditorHeight();- }+ let payload = {};+ if (!create.value) {+ payload = getBacktracePayloadWithIssue(issue.value as Issue);+ }+ // TODO: upload process+ const sheet = await sheetV1Store.createSheet(projectName, {+ title: filename,+ content: new TextEncoder().encode(statement),+ visibility: Sheet_Visibility.VISIBILITY_PROJECT,+ source: Sheet_Source.SOURCE_BYTEBASE_ARTIFACT,+ type: Sheet_Type.TYPE_SQL,+ payload: JSON.stringify(payload),+ });- pushNotification({- module: "bytebase",- style: "INFO",- title: "File upload success",- });+ resetTempEditState();+ updateSheetId(sheetV1Store.getSheetUid(sheet.name));+ await updateStatement(statement);+ state.editing = false;+ if (selectedTask.value) {+ updateEditorHeight();+ }++ pushNotification({+ module: "bytebase",+ style: "INFO",+ title: "File upload success",+ });+ } finally {+ state.isUploadingFile = false;+ }};return new Promise((resolve, reject) => {@@ -562,11 +566,11 @@ const handleUploadFile = async (event: Event, tick: (p: number) => void) => {reject();},onPositiveClick: () => {- resolve(uploadStatementAsSheet(statement));+ resolve(uploadStatementAsSheet());},});} else {- resolve(uploadStatementAsSheet(statement));+ resolve(uploadStatementAsSheet());}});};@@ -578,7 +582,7 @@ const handleUploadFileEvent = (filename: string;content: string;}> => {- return new Promise((resolve) => {+ return new Promise((resolve, reject) => {const target = event.target as HTMLInputElement;const file = (target.files || [])[0];const cleanup = () => {@@ -596,6 +600,7 @@ const handleUploadFileEvent = (title: "File not found",});cleanup();+ reject();return;}if (file.size > maxFileSizeMB * 1024 * 1024) {@@ -607,6 +612,7 @@ const handleUploadFileEvent = (}),});cleanup();+ reject();return;}@@ -625,6 +631,7 @@ const handleUploadFileEvent = (title: "Read file error",description: String(fr.error),});+ reject();};fr.readAsText(file);cleanup();diff --git a/frontend/src/components/misc/UploadProgressButton.vue b/frontend/src/components/misc/UploadProgressButton.vueindex 399e747a17..0356eb6a90 100644--- a/frontend/src/components/misc/UploadProgressButton.vue+++ b/frontend/src/components/misc/UploadProgressButton.vue@@ -73,6 +73,8 @@ const handleUpload = async (e: Event) => {percent.value = -1;try {await props.upload(e, updatePercent);+ } catch {+ // nothing} finally {uploading.value = false;percent.value = -1;