1. If it is just a react project and the DVA framework is introduced, an onerror attribute will be passed in when calling the DVA method
const app = dva({
onError(err) {
// error
console.log(err);
},
});
2. If you are using the UMI framework, you cannot find the place where the DVA is called. Create a new app.js file in the SRC directory and write the following contents
export const dva = {
config: {
onError(e) {
e.preventDefault();
console.error(e.message);
},
},
};
Read More:
- Vue Project Error: Expected indentation of 2 spaces but found 4,Newline required at end of file but not found
- [Solved] React Startup Error at the First time :SyntaxError: Unexpected token
- [Solved] Error: Cannot find module ‘@/views/xxx‘ at webpackEmptyContext
- Vue a page is mounted to send multiple requests at the same time, and the loading is processed uniformly
- Newline required at end of file but not found eol-last [How to Solve]
- [Solved] ESLint error: Newline required at end of file but not found (eol-last)
- Error in created hook: “SyntaxError: Unexpected token u in JSON at position 0
- [Solved] Module build failed TypeError this.getOptions is not a function at Object.loader
- [Solved] Vue beforeeach error: RangeError: Maximum call stack size exceeded at eval (permission.js?223d:39)
- [Solved] Error in created hook: “SyntaxError: Unexpected token o in JSON at position 1“
- How to Solve JS error: Unexpected end of JSON input,Unexpected token u in JSON at position 0
- [Solved] Uncaught SyntaxError: Cannot use import statement outside a module
- [Solved] Uncaught Error: Provide the “history“ option when calling “createRouter()“
- How to solve Uncaught (in promise) error in VUE?
- [Solved] ajax Error: Uncaught SyntaxError: Unexpected end of JSON input
- How to Solve Uncaught (in promise) Error (Two Solutions)
- [Solved] Uncaught SyntaxError: The requested module does not provide an export named
- [Solved] Vue Error: Uncaught TypeError: Vue.createApp is not a function
- [Solved] Echarts Error: Uncaught (in promise) Error: Initialize failed: invalid dom.
- Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to crrent location: “/home“