Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bugsnag/core

Package Overview
Dependencies
Maintainers
7
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bugsnag/core - npm Package Compare versions

Comparing version 6.0.0 to 6.1.0

42

client.js

@@ -160,9 +160,2 @@ const config = require('./config')

// if we have something falsey at this point, report usage error
if (!err) {
const msg = generateNotifyUsageMessage('nothing')
this._logger.warn(`${LOG_USAGE_ERR_PREFIX} ${msg}`)
err = new Error(`${REPORT_USAGE_ERR_PREFIX} ${msg}`)
}
// ensure opts is an object

@@ -172,3 +165,3 @@ if (typeof opts !== 'object' || opts === null) opts = {}

// create a report from the error, if it isn't one already
const report = BugsnagReport.ensureReport(err, errorFramesToSkip, 1)
const report = BugsnagReport.ensureReport(err, errorFramesToSkip, 2)

@@ -197,3 +190,3 @@ report.app = { ...{ releaseStage }, ...report.app, ...this.app }

this._logger.warn(`Report not sent due to releaseStage/notifyReleaseStages configuration`)
return false
return cb(null, report)
}

@@ -214,3 +207,3 @@

this._logger.debug(`Report not sent due to beforeSend callback`)
return false
return cb(null, report)
}

@@ -223,4 +216,3 @@

errorMessage: report.errorMessage,
severity: report.severity,
stacktrace: report.stacktrace
severity: report.severity
}, 'error')

@@ -243,2 +235,10 @@ }

const normaliseError = (error, opts, logger) => {
const synthesizedErrorFramesToSkip = 3
const createAndLogUsageError = reason => {
const msg = generateNotifyUsageMessage(reason)
logger.warn(`${LOG_USAGE_ERR_PREFIX} ${msg}`)
return new Error(`${REPORT_USAGE_ERR_PREFIX} ${msg}`)
}
let err

@@ -252,9 +252,7 @@ let errorFramesToSkip = 0

// report usage/deprecation errors if this function is called like that
const msg = generateNotifyUsageMessage('string/string')
logger.warn(`${LOG_USAGE_ERR_PREFIX} ${msg}`)
err = new Error(`${REPORT_USAGE_ERR_PREFIX} ${msg}`)
err = createAndLogUsageError('string/string')
_opts = { metaData: { notifier: { notifyArgs: [ error, opts ] } } }
} else {
err = new Error(String(error))
errorFramesToSkip += 2
errorFramesToSkip = synthesizedErrorFramesToSkip
}

@@ -267,5 +265,3 @@ break

case 'function':
const msg = generateNotifyUsageMessage('function')
logger.warn(`${LOG_USAGE_ERR_PREFIX} ${msg}`)
err = new Error(`${REPORT_USAGE_ERR_PREFIX} ${msg}`)
err = createAndLogUsageError('function')
break

@@ -278,9 +274,9 @@ case 'object':

err.name = error.name || error.errorClass
errorFramesToSkip += 2
errorFramesToSkip = synthesizedErrorFramesToSkip
} else {
const msg = generateNotifyUsageMessage('unsupported object')
logger.warn(`${LOG_USAGE_ERR_PREFIX} ${msg}`)
err = new Error(`${REPORT_USAGE_ERR_PREFIX} ${msg}`)
err = createAndLogUsageError(error === null ? 'null' : 'unsupported object')
}
break
default:
err = createAndLogUsageError('nothing')
}

@@ -287,0 +283,0 @@ return { err, errorFramesToSkip, _opts }

@@ -12,3 +12,4 @@ const Report = require('../report')

Report.getStacktrace(actualError),
handledState
handledState,
maybeError
)

@@ -15,0 +16,0 @@ if (maybeError !== actualError) report.updateMetaData('error', 'non-error value', String(maybeError))

{
"name": "@bugsnag/core",
"version": "6.0.0",
"version": "6.1.0",
"types": "types/index.d.ts",

@@ -39,3 +39,3 @@ "description": "Core classes and utilities for Bugsnag notifiers",

},
"gitHead": "e4544aab0626dba5031b15dd036c0414709bc105"
"gitHead": "b68f3b063f29f3780488a355563753967cc62cc4"
}

@@ -7,3 +7,3 @@ const ErrorStackParser = require('./lib/error-stack-parser')

class BugsnagReport {
constructor (errorClass, errorMessage, stacktrace = [], handledState = defaultHandledState()) {
constructor (errorClass, errorMessage, stacktrace = [], handledState = defaultHandledState(), originalError) {
// duck-typing ftw >_<

@@ -41,2 +41,3 @@ this.__isBugsnagReport = true

this.session = undefined
this.originalError = originalError
}

@@ -169,5 +170,5 @@

const stacktrace = BugsnagReport.getStacktrace(reportOrError, errorFramesToSkip, 1 + generatedFramesToSkip)
return new BugsnagReport(reportOrError.name, reportOrError.message, stacktrace)
return new BugsnagReport(reportOrError.name, reportOrError.message, stacktrace, undefined, reportOrError)
} catch (e) {
return new BugsnagReport(reportOrError.name, reportOrError.message, [])
return new BugsnagReport(reportOrError.name, reportOrError.message, [], undefined, reportOrError)
}

@@ -174,0 +175,0 @@ }

@@ -25,3 +25,7 @@ import Breadcrumb from "./breadcrumb";

public sessionDelegate(sessionDelegate: common.ISessionDelegate): Client;
public notify(error: common.NotifiableError, opts?: common.INotifyOpts): boolean;
public notify(
error: common.NotifiableError,
opts?: common.INotifyOpts,
cb?: (err: any, report: Report) => void,
): void;
public leaveBreadcrumb(name: string, metaData?: any, type?: string, timestamp?: string): Client;

@@ -28,0 +32,0 @@ public startSession(): Client;

@@ -23,3 +23,3 @@ import Client from "./client";

export type BeforeSend = (report: Report, cb?: (err: null | Error) => void) => void | Promise<void>;
export type BeforeSend = (report: Report, cb?: (err: null | Error) => void) => void | Promise<void> | boolean;

@@ -26,0 +26,0 @@ export interface IPlugin {

@@ -35,4 +35,12 @@ import Breadcrumb from "./breadcrumb";

};
public originalError: any;
constructor(errorClass: string, errorMessage: string, stacktrace?: any[], handledState?: IHandledState);
constructor(
errorClass: string,
errorMessage: string,
stacktrace?: any[],
handledState?: IHandledState,
originalError?: any,
);
public isIgnored(): boolean;

@@ -39,0 +47,0 @@ public ignore(): void;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc