Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_setupSentry() {
Raven.disableConsoleAlerts();
Raven.config(
'https://18d04acdd03b4389a36ef7d1d39f8025:5cb2e99bd3634856bfb3711461201439@sentry.io/196829',
{
name: this.deviceHash,
release: this.getVersion(),
}
).install();
// Just give us something random that we can use to tell how many users are impacted
// by each bug. This is important because sometimes one user will hit an exception 1,000
// times and skew the Sentry data.
Raven.mergeContext({
user: {
id: this.deviceHash,
},
});
Raven.on('error', e => {
console.log(`Raven: ${e.statusCode} - ${e.reason}`);
});
}
};
if (err.protocolMethod) {
// @ts-ignore - properties added to protocol method LHErrors.
opts.fingerprint = ['{{ default }}', err.protocolMethod, err.protocolError];
}
return new Promise(resolve => {
Sentry.captureException(err, opts, () => resolve());
});
};
const context = Object.assign({
url: opts.url,
emulatedFormFactor: opts.flags.emulatedFormFactor,
throttlingMethod: opts.flags.throttlingMethod,
}, opts.flags.throttling);
Sentry.mergeContext({extra: Object.assign({}, opts.environmentData.extra, context)});
} catch (e) {
log.warn(
'sentry',
'Could not load raven library, errors will not be reported.'
);
}
}
}), nr.createTracer('loadDataFailed', (errorDetail) => {
Raven.mergeContext({ extra: { errorDetail, params } })
Raven.captureException(new Error(`LoadData Error - Could Not Render ${feature} view`))
nr.endTransaction()
res.status(404).send(errorDetail)
}))
} catch (ex) {
}, (errorDetail) => {
Raven.mergeContext({ extra: { errorDetail, params } })
Raven.captureException(new Error(`LoadData Error - Could Not Render ${feature} view`))
res.status(404).send(errorDetail)
})
} catch (ex) {
}
} else {
return {
code: 'merge',
message: 'Will merge the pull request',
actions: ['merge']
}
}
case null:
return {
code: 'mergeable_not_supplied',
message: 'GitHub did not provide merge state of PR',
actions: ['reschedule']
}
default:
Raven.mergeContext({
extra: { pullRequestInfo }
})
throw new Error(`Merge state (${pullRequestInfo.mergeStateStatus}) was not recognized`)
}
}
Raven.mergeContext({
extra: {
pullRequestInfo
}
})
const pullRequestStatus = getPullRequestStatus(
context,
conditions,
pullRequestInfo
)
context.log.debug('pullRequestStatus:', pullRequestStatus)
Raven.mergeContext({
extra: {
pullRequestStatus
}
})
log(`result:\n${JSON.stringify(pullRequestStatus, null, 2)}`)
await handlePullRequestStatus(
context,
pullRequestInfo,
pullRequestStatus
)
}
export const captureClientRelease = () => (req, res, next) => {
if (req.headers['x-argos-release-version']) {
raven.mergeContext({
tags: { clientReleaseVersion: req.headers['x-argos-release-version'] },
})
} else if (req.headers['x-argos-cli-version']) {
raven.mergeContext({
tags: { clientCliVersion: req.headers['x-argos-cli-version'] },
})
}
next()
}