🔨 全局异常处理.
This commit is contained in:
@@ -169,7 +169,6 @@
|
|||||||
Message.success('删除成功');
|
Message.success('删除成功');
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -200,7 +199,6 @@
|
|||||||
pagination.total = data.total;
|
pagination.total = data.total;
|
||||||
pagination.current = request.page;
|
pagination.current = request.page;
|
||||||
pagination.pageSize = request.limit;
|
pagination.pageSize = request.limit;
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,8 +135,6 @@
|
|||||||
}
|
}
|
||||||
handleClose();
|
handleClose();
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,8 +139,6 @@
|
|||||||
}
|
}
|
||||||
handleClose();
|
handleClose();
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
|
||||||
return false;
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,7 +202,6 @@
|
|||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -220,7 +219,6 @@
|
|||||||
Message.success('删除成功');
|
Message.success('删除成功');
|
||||||
// 重新加载
|
// 重新加载
|
||||||
reload();
|
reload();
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
@@ -246,7 +244,6 @@
|
|||||||
#if($vue.enableRowSelection)
|
#if($vue.enableRowSelection)
|
||||||
selectedKeys.value = [];
|
selectedKeys.value = [];
|
||||||
#end
|
#end
|
||||||
} catch (e) {
|
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import '@/assets/style/chart.less';
|
|||||||
import '@/assets/style/arco-extends.less';
|
import '@/assets/style/arco-extends.less';
|
||||||
import '@/api/interceptor';
|
import '@/api/interceptor';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
import globalErrorHandler from '@/utils/monitor';
|
||||||
|
|
||||||
const app = createApp(App);
|
const app = createApp(App);
|
||||||
|
|
||||||
@@ -26,6 +27,9 @@ app.use(i18n);
|
|||||||
app.use(globalComponents);
|
app.use(globalComponents);
|
||||||
app.use(directive);
|
app.use(directive);
|
||||||
|
|
||||||
|
// 全局异常处理
|
||||||
|
globalErrorHandler(app);
|
||||||
|
|
||||||
app.mount('#app');
|
app.mount('#app');
|
||||||
|
|
||||||
// 监听 PWA 注册事件
|
// 监听 PWA 注册事件
|
||||||
|
|||||||
@@ -40,5 +40,6 @@ export const playBellHz = (frequency: number = 400, duration: number = .15) => {
|
|||||||
source.connect(audioCtx.destination);
|
source.connect(audioCtx.destination);
|
||||||
source.start();
|
source.start();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// ignored
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,28 +1,14 @@
|
|||||||
import type { App, ComponentPublicInstance } from 'vue';
|
import type { App, ComponentPublicInstance } from 'vue';
|
||||||
import axios from 'axios';
|
|
||||||
|
|
||||||
export default function handleError(Vue: App, baseUrl: string) {
|
/**
|
||||||
if (!baseUrl) {
|
* 全局异常处理
|
||||||
return;
|
*/
|
||||||
}
|
export default function globalErrorHandler(Vue: App) {
|
||||||
Vue.config.errorHandler = (
|
Vue.config.errorHandler = (
|
||||||
err: unknown,
|
err: unknown,
|
||||||
instance: ComponentPublicInstance | null,
|
instance: ComponentPublicInstance | null,
|
||||||
info: string
|
info: string
|
||||||
) => {
|
) => {
|
||||||
// send error info
|
console.error(info, err);
|
||||||
axios.post(`${baseUrl}/report-error`, {
|
|
||||||
err,
|
|
||||||
instance,
|
|
||||||
info,
|
|
||||||
// location: window.location.href,
|
|
||||||
// message: err.message,
|
|
||||||
// stack: err.stack,
|
|
||||||
// browserInfo: getBrowserInfo(),
|
|
||||||
// user info
|
|
||||||
// dom info
|
|
||||||
// url info
|
|
||||||
// ...
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user