File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,26 @@ let router
28
28
const NUXT = window . __NUXT__ || { }
29
29
NUXT . components = window . __COMPONENTS__ || null
30
30
31
+ // Setup global Vue error handler
32
+ const defaultErrorHandler = Vue . config . errorHandler
33
+ Vue . config . errorHandler = function ( err , vm , info ) {
34
+ // Show Nuxt Error Page
35
+ if ( vm && vm . $root && vm . $root . $nuxt ) {
36
+ vm . $root . $nuxt . error ( err )
37
+ }
38
+
39
+ // Call other handler if exist
40
+ if ( typeof defaultErrorHandler === 'function' ) {
41
+ return defaultErrorHandler ( ...arguments )
42
+ }
43
+
44
+ // Log to console (default vue behavior)
45
+ if ( process . env . NODE_ENV !== 'production' ) {
46
+ console . warn ( ( 'Error in ' + info + ': "' + err . toString ( ) + '"' ) , vm ) ;
47
+ }
48
+ console . error ( err ) ;
49
+ }
50
+
31
51
// Create and mount App
32
52
createApp ( )
33
53
. then ( mountApp )
You can’t perform that action at this time.
0 commit comments