Closed
Description
Right now, this code can cause problems:
var metaData = {
componentName: formatComponentName(vm),
propsData: vm.$options.propsData
};
If vm is null (which happens on occasion for me), or if propsData contain cyclic data structures, it throws an exception during the error handler, which is unfortunate, as both errors don't get reported properly. This is my proposed change:
Vue.config.errorHandler = function VueErrorHandler(error, vm, info) {
var metaData = {};
try {
metaData.componentName = formatComponentName(vm);
// lifecycleHook is not always available
if (typeof info !== 'undefined') {
metaData.lifecycleHook = info;
}
var propsData =vm && vm.$options && vm.$options.propsData;
// ensure we can JSON-stringify the props, before passing them up:
var text = JSON.stringify(propsData);
metaData.propsData = propsData;
} catch (x) {
// if we have a problem above, we just don't get whiz-bang data,
// and we report that error as well:
Raven.captureException(x);
}
Raven.captureException(error, {
extra: metaData,
});
if (typeof _oldOnError === 'function') {
_oldOnError.call(this, error, vm, info);
}
};
Metadata
Metadata
Assignees
Labels
No labels