Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
Surface internal error notification on the page instead of just rendering the plain text
Tianzhou Cheneee7549f6e96
diff --git a/frontend/src/App.vue b/frontend/src/App.vueindex e400672a50..8a45bd815b 100644--- a/frontend/src/App.vue+++ b/frontend/src/App.vue@@ -3,8 +3,24 @@</template><script lang="ts">+import { onErrorCaptured } from "vue";+import { useStore } from "vuex";+export default {name: "App",components: {},+ setup(props, ctx) {+ const store = useStore();++ onErrorCaptured((e: any, _, info) => {+ store.dispatch("notification/pushNotification", {+ module: "bytebase",+ style: "CRITICAL",+ title: `Internal error occured in '${info}'.`,+ description: e.stack,+ });+ return true;+ });+ },};</script>diff --git a/frontend/src/layouts/DashboardLayout.vue b/frontend/src/layouts/DashboardLayout.vueindex 2fdb798430..e57ff26e4b 100644--- a/frontend/src/layouts/DashboardLayout.vue+++ b/frontend/src/layouts/DashboardLayout.vue@@ -1,7 +1,6 @@<template>- <h1 v-if="error">Failed to load {{ error.stack }}</h1><!-- Suspense is experimental, be aware of the potential change -->- <Suspense v-else>+ <Suspense><template #default><div><ProvideContext>@@ -30,7 +29,7 @@</template><script lang="ts">-import { reactive, watchEffect, onErrorCaptured, ref } from "vue";+import { reactive, watchEffect, ref } from "vue";import { useStore } from "vuex";import ProvideContext from "../components/ProvideContext.vue";import DashboardHeader from "../views/DashboardHeader.vue";@@ -49,12 +48,6 @@ export default {components: { ProvideContext, DashboardHeader, BannerDemo },setup(props, ctx) {const store = useStore();- const error = ref();-- onErrorCaptured((e) => {- error.value = e;- return true;- });const state = reactive<LocalState>({notification: null,@@ -84,7 +77,6 @@ export default {watchEffect(watchNotification);return {- error,state,isDemo,};