File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 4
4
*/
5
5
'use strict' ;
6
6
7
+ function formatComponentName ( vm ) {
8
+ if ( vm . $root === vm ) {
9
+ return 'root instance'
10
+ }
11
+ var name = vm . _isVue
12
+ ? vm . $options . name || vm . $options . _componentTag
13
+ : vm . name
14
+ return ( name ? 'component <' + name + '>' : 'anonymous component' ) +
15
+ ( vm . _isVue && vm . $options . __file ? ' at ' + vm . $options . __file : '' )
16
+ }
17
+
7
18
function vuePlugin ( Raven , Vue ) {
8
19
Vue = Vue || window . Vue ;
9
20
@@ -14,7 +25,7 @@ function vuePlugin(Raven, Vue) {
14
25
Vue . config . errorHandler = function VueErrorHandler ( error , vm ) {
15
26
Raven . captureException ( error , {
16
27
extra : {
17
- componentName : Vue . util . formatComponentName ( vm ) ,
28
+ componentName : formatComponentName ( vm ) ,
18
29
propsData : vm . $options . propsData
19
30
}
20
31
} ) ;
Original file line number Diff line number Diff line change @@ -12,12 +12,7 @@ describe('Vue plugin', function () {
12
12
beforeEach ( function ( ) {
13
13
this . sinon . stub ( Raven , 'captureException' ) ;
14
14
this . MockVue = {
15
- config : { } ,
16
- util : {
17
- formatComponentName : function ( ) {
18
- return '<root component>'
19
- }
20
- }
15
+ config : { }
21
16
} ;
22
17
} ) ;
23
18
@@ -38,7 +33,7 @@ describe('Vue plugin', function () {
38
33
propsData : {
39
34
foo : 'bar'
40
35
} ,
41
- componentName : '<root component> '
36
+ componentName : 'anonymous component'
42
37
} ) ;
43
38
} ) ;
44
39
You can’t perform that action at this time.
0 commit comments