A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/getsentry/sentry-javascript/issues/1061 below:

Vue Plugin Errors · Issue #1061 · getsentry/sentry-javascript · GitHub

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);
    }
  };

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4