Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var Bugsnag = require('@bugsnag/node')
Bugsnag.init({
apiKey: process.env.BUGSNAG_API_KEY,
endpoints: {
notify: process.env.BUGSNAG_NOTIFY_ENDPOINT,
sessions: process.env.BUGSNAG_SESSIONS_ENDPOINT
},
sendCode: false
})
function add (a) {
return function (b) {
return a + b
}
}
add(5)(2) // -> 7
subtract(5)(2) // -> 3
var Bugsnag = require('@bugsnag/node')
Bugsnag.init({
apiKey: process.env.BUGSNAG_API_KEY,
endpoints: {
notify: process.env.BUGSNAG_NOTIFY_ENDPOINT,
sessions: process.env.BUGSNAG_SESSIONS_ENDPOINT
}
})
//
function add (a) {
return function (b) {
return a + b
}
}
add(5)(2) // -> 7
subtract(5)(2) // -> 3
notify: process.env.BUGSNAG_NOTIFY_ENDPOINT,
sessions: process.env.BUGSNAG_SESSIONS_ENDPOINT
},
sendCode: false
})
function add (a) {
return function (b) {
return a + b
}
}
add(5)(2) // -> 7
subtract(5)(2) // -> 3
Bugsnag.notify(new Error('surround me'))
function subtract (a) {
return function (b) {
return add(a)(-b)
}
}
notify: process.env.BUGSNAG_NOTIFY_ENDPOINT,
sessions: process.env.BUGSNAG_SESSIONS_ENDPOINT
}
})
//
function add (a) {
return function (b) {
return a + b
}
}
add(5)(2) // -> 7
subtract(5)(2) // -> 3
Bugsnag.notify(new Error('surround me'))
function subtract (a) {
return function (b) {
return add(a)(-b)
}
}
export const setupErrorHandling = (appType) => {
if (remote) {
// eslint-disable-next-line no-proto
setTimeout(() => {}).__proto__.unref = () => {};
}
const handleError = (error) => {
logger.error(error && (error.stack || error));
!remote && app.quit(1);
};
if (process.env.BUGSNAG_API_KEY) {
bugsnagClient = bugsnag({
apiKey: process.env.BUGSNAG_API_KEY,
appVersion: app.getVersion(),
appType,
collectUserIp: false,
onUncaughtException: handleError,
onUnhandledRejection: handleError,
releaseStage: process.env.NODE_ENV,
});
return;
}
process.on('uncaughtException', handleError);
process.on('unhandledRejection', handleError);
};
var Bugsnag = require('@bugsnag/node')
var ProxyAgent = require('http-proxy-agent')
Bugsnag.init({
apiKey: process.env.BUGSNAG_API_KEY,
endpoints: {
notify: process.env.BUGSNAG_NOTIFY_ENDPOINT,
sessions: process.env.BUGSNAG_SESSIONS_ENDPOINT
},
agent: new ProxyAgent('http://whoops:32228')
})
Bugsnag.notify(new Error('hi via proxy'))
var Bugsnag = require('@bugsnag/node')
Bugsnag.init({
apiKey: process.env.BUGSNAG_API_KEY,
endpoints: {
notify: process.env.BUGSNAG_NOTIFY_ENDPOINT,
sessions: process.env.BUGSNAG_SESSIONS_ENDPOINT
}
})
Promise.reject(new Error('not handled'))
var Bugsnag = require('@bugsnag/node')
Bugsnag.init({
apiKey: process.env.BUGSNAG_API_KEY,
endpoints: {
notify: process.env.BUGSNAG_NOTIFY_ENDPOINT,
sessions: process.env.BUGSNAG_SESSIONS_ENDPOINT
}
})
throw new Error('not handled')
var Bugsnag = require('@bugsnag/node')
Bugsnag.init({
apiKey: process.env.BUGSNAG_API_KEY,
endpoints: {
notify: process.env.BUGSNAG_NOTIFY_ENDPOINT,
sessions: process.env.BUGSNAG_SESSIONS_ENDPOINT
}
})
Bugsnag.notify('create an error for me')
var Bugsnag = require('@bugsnag/node')
Bugsnag.init({
apiKey: process.env.BUGSNAG_API_KEY,
endpoints: {
notify: process.env.BUGSNAG_NOTIFY_ENDPOINT,
sessions: process.env.BUGSNAG_SESSIONS_ENDPOINT
}
})
Bugsnag.notify('create an error for me')