linkederrors.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Object.defineProperty(exports, '__esModule', { value: true });
  2. const core = require('@sentry/core');
  3. const utils = require('@sentry/utils');
  4. const eventbuilder = require('../eventbuilder.js');
  5. const DEFAULT_KEY = 'cause';
  6. const DEFAULT_LIMIT = 5;
  7. const INTEGRATION_NAME = 'LinkedErrors';
  8. const _linkedErrorsIntegration = ((options = {}) => {
  9. const limit = options.limit || DEFAULT_LIMIT;
  10. const key = options.key || DEFAULT_KEY;
  11. return {
  12. name: INTEGRATION_NAME,
  13. // TODO v8: Remove this
  14. setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
  15. preprocessEvent(event, hint, client) {
  16. const options = client.getOptions();
  17. utils.applyAggregateErrorsToEvent(
  18. // This differs from the LinkedErrors integration in core by using a different exceptionFromError function
  19. eventbuilder.exceptionFromError,
  20. options.stackParser,
  21. options.maxValueLength,
  22. key,
  23. limit,
  24. event,
  25. hint,
  26. );
  27. },
  28. };
  29. }) ;
  30. const linkedErrorsIntegration = core.defineIntegration(_linkedErrorsIntegration);
  31. /**
  32. * Aggregrate linked errors in an event.
  33. * @deprecated Use `linkedErrorsIntegration()` instead.
  34. */
  35. // eslint-disable-next-line deprecation/deprecation
  36. const LinkedErrors = core.convertIntegrationFnToClass(INTEGRATION_NAME, linkedErrorsIntegration)
  37. ;
  38. exports.LinkedErrors = LinkedErrors;
  39. exports.linkedErrorsIntegration = linkedErrorsIntegration;
  40. //# sourceMappingURL=linkederrors.js.map