Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
client.config.beforeSend.unshift(report => {
// remove any of our own frames that may be part the stack this
// happens before the inline script check as it happens for all errors
report.stacktrace = filter(report.stacktrace, f => !(/__trace__$/.test(f.method)))
const frame = report.stacktrace[0]
// if frame.file exists and is not the original location of the page, this can't be an inline script
if (frame && frame.file && frame.file.replace(/#.*$/, '') !== originalLocation.replace(/#.*$/, '')) return
// grab the last script known to have run
const currentScript = getCurrentScript()
if (currentScript) {
const content = currentScript.innerHTML
report.updateMetaData(
'script',
'content',
content.length <= MAX_SCRIPT_LENGTH ? content : content.substr(0, MAX_SCRIPT_LENGTH)
)
}
exports.configSchema = {
consoleBreadcrumbsEnabled: {
defaultValue: () => undefined,
validate: (value) => value === true || value === false || value === undefined,
message: 'should be true|false'
}
}
if (process.env.NODE_ENV !== 'production') {
exports.destroy = () => CONSOLE_LOG_METHODS.forEach(method => {
if (typeof console[method]._restore === 'function') console[method]._restore()
})
}
const CONSOLE_LOG_METHODS = filter([ 'log', 'debug', 'info', 'warn', 'error' ], method =>
typeof console !== 'undefined' && typeof console[method] === 'function'
)