|
@@ -19,6 +19,12 @@ function getHasRouteMatched (router) {
|
|
|
return hasRouteMatched
|
|
|
}
|
|
|
|
|
|
+function sendNotFindPageError (content, options) {
|
|
|
+ if (window.Sentry && typeof window.Sentry.captureMessage === 'function') {
|
|
|
+ Sentry.captureMessage(content, options)
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* 子应用 404 页面拦截
|
|
|
* @param router
|
|
@@ -29,6 +35,17 @@ function addNotFindPage(router) {
|
|
|
// vue-router相关路由,history.state中必有key
|
|
|
var vueRouterHistory = history.state && history.state.key
|
|
|
if (to.matched.length === 0 && vueRouterHistory) {
|
|
|
+ sendNotFindPageError(new Error('Error getHasRouteMatched beforeEach'), {
|
|
|
+ level: 'error',
|
|
|
+ tags: {
|
|
|
+ href: location.href
|
|
|
+ },
|
|
|
+ extra: {
|
|
|
+ router: router,
|
|
|
+ to: to,
|
|
|
+ from: from
|
|
|
+ }
|
|
|
+ })
|
|
|
window.top.location.replace(notFindPage);
|
|
|
} else {
|
|
|
next();
|
|
@@ -36,6 +53,15 @@ function addNotFindPage(router) {
|
|
|
});
|
|
|
|
|
|
if (!getHasRouteMatched(router)) {
|
|
|
+ sendNotFindPageError(new Error('Error getHasRouteMatched'), {
|
|
|
+ level: 'error',
|
|
|
+ tags: {
|
|
|
+ href: location.href
|
|
|
+ },
|
|
|
+ extra: {
|
|
|
+ router: router
|
|
|
+ }
|
|
|
+ })
|
|
|
window.top.location.replace(notFindPage);
|
|
|
}
|
|
|
}
|