File tree 4 files changed +10
-12
lines changed
test/unit/features/global-api
4 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -60,18 +60,14 @@ export function renderMixin (Vue: Class<Component>) {
60
60
try {
61
61
vnode = render . call ( vm . _renderProxy , vm . $createElement )
62
62
} catch ( e ) {
63
- if ( process . env . NODE_ENV !== 'production' ) {
64
- warn ( `Error when rendering ${ formatComponentName ( vm ) } :` )
65
- }
66
63
/* istanbul ignore else */
67
64
if ( config . errorHandler ) {
68
65
config . errorHandler . call ( null , e , vm )
69
66
} else {
70
- if ( isServerRendering ( ) ) {
71
- throw e
72
- } else {
73
- console . error ( e )
67
+ if ( process . env . NODE_ENV !== 'production' ) {
68
+ warn ( `Error when rendering ${ formatComponentName ( vm ) } :` )
74
69
}
70
+ throw e
75
71
}
76
72
// return previous vnode to prevent render error causing blank component
77
73
vnode = vm . _vnode
Original file line number Diff line number Diff line change @@ -166,14 +166,14 @@ export default class Watcher {
166
166
try {
167
167
this . cb . call ( this . vm , value , oldValue )
168
168
} catch ( e ) {
169
- process . env . NODE_ENV !== 'production' && warn (
170
- `Error in watcher "${ this . expression } "` ,
171
- this . vm
172
- )
173
169
/* istanbul ignore else */
174
170
if ( config . errorHandler ) {
175
171
config . errorHandler . call ( null , e , this . vm )
176
172
} else {
173
+ process . env . NODE_ENV !== 'production' && warn (
174
+ `Error in watcher "${ this . expression } "` ,
175
+ this . vm
176
+ )
177
177
throw e
178
178
}
179
179
}
Original file line number Diff line number Diff line change @@ -66,8 +66,9 @@ export const nextTick = (function () {
66
66
/* istanbul ignore if */
67
67
if ( typeof Promise !== 'undefined' && isNative ( Promise ) ) {
68
68
var p = Promise . resolve ( )
69
+ var logError = err => { console . error ( err ) }
69
70
timerFunc = ( ) => {
70
- p . then ( nextTickHandler )
71
+ p . then ( nextTickHandler ) . catch ( logError )
71
72
// in problematic UIWebViews, Promise.then doesn't completely break, but
72
73
// it can get stuck in a weird state where callbacks are pushed into the
73
74
// microtask queue but the queue isn't being flushed, until the browser
Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ describe('Global config', () => {
39
39
Vue . config . errorHandler = spy
40
40
const err = new Error ( )
41
41
const vm = new Vue ( {
42
+ render ( ) { } ,
42
43
data : { a : 1 } ,
43
44
watch : {
44
45
a : ( ) => {
You can’t perform that action at this time.
0 commit comments