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 44 */
55'use strict' ;
66
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+
718function vuePlugin ( Raven , Vue ) {
819 Vue = Vue || window . Vue ;
920
@@ -14,7 +25,7 @@ function vuePlugin(Raven, Vue) {
1425 Vue . config . errorHandler = function VueErrorHandler ( error , vm ) {
1526 Raven . captureException ( error , {
1627 extra : {
17- componentName : Vue . util . formatComponentName ( vm ) ,
28+ componentName : formatComponentName ( vm ) ,
1829 propsData : vm . $options . propsData
1930 }
2031 } ) ;
Original file line number Diff line number Diff line change @@ -12,12 +12,7 @@ describe('Vue plugin', function () {
1212 beforeEach ( function ( ) {
1313 this . sinon . stub ( Raven , 'captureException' ) ;
1414 this . MockVue = {
15- config : { } ,
16- util : {
17- formatComponentName : function ( ) {
18- return '<root component>'
19- }
20- }
15+ config : { }
2116 } ;
2217 } ) ;
2318
@@ -38,7 +33,7 @@ describe('Vue plugin', function () {
3833 propsData : {
3934 foo : 'bar'
4035 } ,
41- componentName : '<root component> '
36+ componentName : 'anonymous component'
4237 } ) ;
4338 } ) ;
4439
You can’t perform that action at this time.
0 commit comments