@honeybadger-io/js 6.12.2 → 6.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -559,7 +559,7 @@
559
559
  }
560
560
  else if (isErrorObject(thing)) {
561
561
  var e = thing;
562
- notice = merge(thing, { name: e.name, message: e.message, stack: e.stack, cause: e.cause });
562
+ notice = merge(thing, { name: e.name, message: e.message, stack: e.stack, cause: e.cause, originalError: e });
563
563
  }
564
564
  else if (typeof thing === 'object') {
565
565
  notice = shallowClone(thing);
@@ -1198,7 +1198,7 @@
1198
1198
  this.__notifier = {
1199
1199
  name: '@honeybadger-io/core',
1200
1200
  url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/core',
1201
- version: '6.12.2'
1201
+ version: '6.14.0'
1202
1202
  };
1203
1203
  this.config = __assign$1(__assign$1({}, defaults_1.CONFIG), opts);
1204
1204
  this.__initStore();
@@ -1819,7 +1819,7 @@
1819
1819
  onerror.onError = onerror.ignoreNextOnError = void 0;
1820
1820
  /* eslint-disable prefer-rest-params */
1821
1821
  var core_1$6 = src;
1822
- var instrument$4 = core_1$6.Util.instrument, makeNotice = core_1$6.Util.makeNotice, globalThisOrWindow$6 = core_1$6.Util.globalThisOrWindow;
1822
+ var instrument$4 = core_1$6.Util.instrument, makeNotice$1 = core_1$6.Util.makeNotice, globalThisOrWindow$6 = core_1$6.Util.globalThisOrWindow;
1823
1823
  var ignoreOnError = 0;
1824
1824
  var currentTimeout;
1825
1825
  function ignoreNextOnError() {
@@ -1851,7 +1851,7 @@
1851
1851
  }
1852
1852
  return;
1853
1853
  }
1854
- var notice = makeNotice(err);
1854
+ var notice = makeNotice$1(err);
1855
1855
  if (!notice.name) {
1856
1856
  notice.name = 'window.onerror';
1857
1857
  }
@@ -1892,7 +1892,7 @@
1892
1892
  Object.defineProperty(onunhandledrejection, "__esModule", { value: true });
1893
1893
  /* eslint-disable prefer-rest-params */
1894
1894
  var core_1$5 = src;
1895
- var instrument$3 = core_1$5.Util.instrument, globalThisOrWindow$5 = core_1$5.Util.globalThisOrWindow;
1895
+ var instrument$3 = core_1$5.Util.instrument, makeNotice = core_1$5.Util.makeNotice, globalThisOrWindow$5 = core_1$5.Util.globalThisOrWindow;
1896
1896
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1897
1897
  function default_1$3(_window) {
1898
1898
  if (_window === void 0) { _window = globalThisOrWindow$5(); }
@@ -1911,23 +1911,16 @@
1911
1911
  }
1912
1912
  var reason = promiseRejectionEvent.reason;
1913
1913
  if (reason instanceof Error) {
1914
- // simulate v8 stack
1915
- // const fileName = reason.fileName || 'unknown'
1916
- // const lineNumber = reason.lineNumber || 0
1917
- var fileName = 'unknown';
1918
- var lineNumber = 0;
1919
- var stackFallback = "".concat(reason.message, "\n at ? (").concat(fileName, ":").concat(lineNumber, ")");
1920
- var stack = reason.stack || stackFallback;
1921
- var err = {
1922
- name: reason.name,
1923
- message: "UnhandledPromiseRejectionWarning: ".concat(reason),
1924
- stack: stack
1925
- };
1926
- client.addBreadcrumb("window.onunhandledrejection: ".concat(err.name), {
1914
+ var notice = makeNotice(reason);
1915
+ if (!notice.stack) {
1916
+ notice.stack = "".concat(reason.message, "\n at ? (unknown:0)");
1917
+ }
1918
+ notice.message = "UnhandledPromiseRejectionWarning: ".concat(reason);
1919
+ client.addBreadcrumb("window.onunhandledrejection: ".concat(notice.name), {
1927
1920
  category: 'error',
1928
- metadata: err
1921
+ metadata: { name: notice.name, message: notice.message, stack: notice.stack }
1929
1922
  });
1930
- client.notify(err);
1923
+ client.notify(notice);
1931
1924
  return;
1932
1925
  }
1933
1926
  var message = typeof reason === 'string' ? reason : ((_a = JSON.stringify(reason)) !== null && _a !== void 0 ? _a : 'Unspecified reason');
@@ -2559,7 +2552,7 @@
2559
2552
  __extends(Honeybadger, _super);
2560
2553
  function Honeybadger(opts) {
2561
2554
  if (opts === void 0) { opts = {}; }
2562
- var _this = _super.call(this, __assign({ userFeedbackEndpoint: 'https://api.honeybadger.io/v2/feedback', async: true, maxErrors: null, projectRoot: getProjectRoot() }, opts), new transport_1.BrowserTransport({
2555
+ var _this = _super.call(this, __assign({ userFeedbackEndpoint: 'https://api.honeybadger.io/v2/feedback', async: true, maxErrors: null, ignoreBrowserExtensionErrors: false, projectRoot: getProjectRoot() }, opts), new transport_1.BrowserTransport({
2563
2556
  'User-Agent': userAgent(),
2564
2557
  })) || this;
2565
2558
  /** @internal */
@@ -2571,6 +2564,18 @@
2571
2564
  /** @internal */
2572
2565
  _this.__beforeNotifyHandlers = [
2573
2566
  function (notice) {
2567
+ if (_this.config.ignoreBrowserExtensionErrors &&
2568
+ notice && notice.backtrace && notice.backtrace.length) {
2569
+ var topFrame = notice.backtrace[0];
2570
+ if (topFrame && typeof topFrame.file === 'string' &&
2571
+ (topFrame.file.startsWith('chrome-extension://') ||
2572
+ topFrame.file.startsWith('moz-extension://') ||
2573
+ topFrame.file.startsWith('safari-extension://') ||
2574
+ topFrame.file.startsWith('safari-web-extension://'))) {
2575
+ _this.logger.debug('Dropping notice: browser extension error', notice);
2576
+ return false;
2577
+ }
2578
+ }
2574
2579
  if (_this.__exceedsMaxErrors()) {
2575
2580
  _this.logger.debug('Dropping notice: max errors exceeded', notice);
2576
2581
  return false;
@@ -2721,7 +2726,7 @@
2721
2726
  var NOTIFIER = {
2722
2727
  name: '@honeybadger-io/js',
2723
2728
  url: 'https://github.com/honeybadger-io/honeybadger-js/tree/master/packages/js',
2724
- version: '6.12.2'
2729
+ version: '6.14.0'
2725
2730
  };
2726
2731
  var userAgent = function () {
2727
2732
  if (typeof navigator !== 'undefined') {