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 22
33## Unreleased
44
5- - None
5+ - [ integrations] feat: Add logErrors option to Vue integration (#2182 )
6+ - [ browser] test: Complete rewrite of Browser Integration Tests (#2176 )
67
78## 5.5.0
89
Original file line number Diff line number Diff line change @@ -33,12 +33,22 @@ export class Vue implements Integration {
3333 */
3434 private readonly _attachProps : boolean = true ;
3535
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+
3642 /**
3743 * @inheritDoc
3844 */
39- public constructor ( options : { Vue ?: any ; attachProps ?: boolean } = { } ) {
45+ public constructor ( options : { Vue ?: any ; attachProps ?: boolean ; logErrors ?: boolean } = { } ) {
4046 // tslint:disable-next-line: no-unsafe-any
4147 this . _Vue = options . Vue || getGlobalObject < any > ( ) . Vue ;
48+
49+ if ( options . logErrors !== undefined ) {
50+ this . _logErrors = options . logErrors ;
51+ }
4252 if ( options . attachProps === false ) {
4353 this . _attachProps = false ;
4454 }
@@ -99,6 +109,14 @@ export class Vue implements Integration {
99109 if ( typeof oldOnError === 'function' ) {
100110 oldOnError . call ( this . _Vue , error , vm , info ) ;
101111 }
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+ }
102120 } ;
103121 }
104122}
You can’t perform that action at this time.
0 commit comments