Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (level == 'error') {
// Support exceptions logging
if (meta instanceof Error) {
if (msg == '') {
msg = meta;
} else {
meta.message = msg + ". cause: " + meta.message;
msg = meta;
}
}
Raven.captureException(msg, extra, function() {
callback(null, true);
});
} else {
Raven.captureMessage(msg, extra, function() {
callback(null, true);
});
}
} catch(err) {
console.error(err);
}
};
export function logError(message: string, options?: any): void {
// send error to Sentry
// add `testing: true` to tags to avoid sending an email when testing
Raven.captureMessage(message, getOptions(options));
}
run(event, args, error) {
this.client.emit("wtf", `[EVENT] ${event.path}\n${error ? error.stack ? error.stack : error : "Unknown error"}`);
Raven.captureMessage(`eventError: ${event.name}\n${error ? error.stack ? error.stack : error : "Unknown error"}`);
}
run(message, command, params, error) {
if (error instanceof Error) {
this.client.emit("wtf", `[COMMAND] ${command.path}\n${error.stack || error}`);
Raven.captureMessage(`commandError: ${command.name}\n${error.stack || error}`);
}
if (error.message) message.sendCode("JSON", error.message).catch(err => this.client.emit("wtf", err));
else message.sendMessage(error).catch(err => this.client.emit("wtf", err));
}
error: info => {
console.log(chalk`${new Date()} {bold.red ERROR}: ${info}`)
raven.captureMessage(info)
},
warn: info => console.log(chalk`${new Date()} {bold.yellow WARN}: ${info}`),
exports.sendRavenMessage = function(req, message, options) {
if (!useRaven) {
return;
}
options = makeOptionsFromRequest(req, options);
Raven.captureMessage(message, options);
};
log(msg, level, context) {
let nativeLevel = RavenBrowserDriver._mapLevel(level);
Raven.captureMessage(msg, {
level: nativeLevel,
extra: context,
tags: {
originalLevel: level,
},
});
}
return new Promise((resolve, _) => {
if (process.env.SENTRY_DNS) {
Raven.captureMessage(msg, resolve);
} else {
resolve();
}
});
}
exports.log = (msg, meta) => {
if (sentryEnabled) {
if (meta.level === 'error' || meta.level === 'fatal') {
Raven.captureException(msg, meta);
}
Raven.captureMessage(msg, meta);
}
};
(err, res) => {
if (err) {
Raven.captureMessage('Unexpected ORCID failure', { err })
reject(
'An unexpected ORCID login failure occurred, please try again later.',
)
}
const doc = new xmldoc.XmlDocument(res.body)
let name = doc.valueWithPath(
'person:person.person:name.personal-details:credit-name',
)
const firstname = doc.valueWithPath(
'person:person.person:name.personal-details:given-names',
)
const lastname = doc.valueWithPath(
'person:person.person:name.personal-details:family-name',
)
const email = doc.valueWithPath(
'person:person.email:emails.email:email.email:email',