8000
File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed
packages/integrations/src Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## Unreleased
4
4
5
- - None
5
+ - [ integrations] feat: Add logErrors option to Vue integration (#2182 )
6
+ - [ browser] test: Complete rewrite of Browser Integration Tests (#2176 )
6
7
7
8
## 5.5.0
8
9
Original file line number Diff line number Diff line change @@ -33,12 +33,22 @@ export class Vue implements Integration {
33
33
8000
code>
*/
34
34
private readonly _attachProps : boolean = true ;
35
35
36
+ /**
37
+ * When set to true, original Vue's `logError` will be called as well.
38
+ * https://github.com/vuejs/vue/blob/c2b1cfe9ccd08835f2d99f6ce60f67b4de55187f/src/core/util/error.js#L38-L48
39
+ */
40
+ private readonly _logErrors : boolean = false ;
41
+
36
42
/**
37
43
* @inheritDoc
38
44
*/
39
- public constructor ( options : { Vue ?: any ; attachProps ?: boolean } = { } ) {
45
+ public constructor ( options : { Vue ?: any ; attachProps ?: boolean ; logErrors ?: boolean } = { } ) {
40
46
// tslint:disable-next-line: no-unsafe-any
41
47
this . _Vue = options . Vue || getGlobalObject < any > ( ) . Vue ;
48
+
49
+ if ( options . logErrors !== undefined ) {
50
+ this . _logErrors = options . logErrors ;
51
+ }
42
52
if ( options . attachProps === false ) {
43
53
this . _attachProps = false ;
44
54
}
@@ -99,6 +109,14 @@ export class Vue implements Integration {
99
109
if ( typeof oldOnError === 'function' ) {
100
110
oldOnError . call ( this . _Vue , error , vm , info ) ;
101
111
}
112
+
113
+ if ( this . _logErrors ) {
114
+ if ( process && process . env && process . env . NODE_ENV !== 'production' ) {
115
+ this . _Vue . util . warn ( `Error in ${ info } : "${ error . toString ( ) } "` , vm ) ;
116
+ }
117
+ // tslint:disable-next-line:no-console
118
+ console . error ( error ) ;
119
+ }
102
120
} ;
103
121
}
104
122
}
You can’t perform that action at this time.
0 commit comments