MOON
Server: Apache
System: Linux nserver.cafsindia.com 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: cafsindia (1002)
PHP: 8.2.30
Disabled: NONE
Upload Files
File: //home/cafsindia/snap.cafsinfotech.in/node_modules/@sentry/vue/esm/errorhandler.js
import { getCurrentHub } from '@sentry/browser';
import { addExceptionMechanism } from '@sentry/utils';
import { formatComponentName, generateComponentTrace } from './vendor/components.js';

const attachErrorHandler = (app, options) => {
  const { errorHandler, warnHandler, silent } = app.config;

  app.config.errorHandler = (error, vm, lifecycleHook) => {
    const componentName = formatComponentName(vm, false);
    const trace = vm ? generateComponentTrace(vm) : '';
    const metadata = {
      componentName,
      lifecycleHook,
      trace,
    };

    if (options.attachProps && vm) {
      // Vue2 - $options.propsData
      // Vue3 - $props
      if (vm.$options && vm.$options.propsData) {
        metadata.propsData = vm.$options.propsData;
      } else if (vm.$props) {
        metadata.propsData = vm.$props;
      }
    }

    // Capture exception in the next event loop, to make sure that all breadcrumbs are recorded in time.
    setTimeout(() => {
      getCurrentHub().withScope(scope => {
        scope.setContext('vue', metadata);

        scope.addEventProcessor(event => {
          addExceptionMechanism(event, {
            handled: false,
          });
          return event;
        });

        getCurrentHub().captureException(error);
      });
    });

    if (typeof errorHandler === 'function') {
      (errorHandler ).call(app, error, vm, lifecycleHook);
    }

    if (options.logErrors) {
      const hasConsole = typeof console !== 'undefined';
      const message = `Error in ${lifecycleHook}: "${error && error.toString()}"`;

      if (warnHandler) {
        (warnHandler ).call(null, message, vm, trace);
      } else if (hasConsole && !silent) {
        // eslint-disable-next-line no-console
        console.error(`[Vue warn]: ${message}${trace}`);
      }
    }
  };
};

export { attachErrorHandler };
//# sourceMappingURL=errorhandler.js.map