Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike {
const syntheticException = (hint && hint.syntheticException) || undefined;
const event = eventFromString(message, syntheticException, {
attachStacktrace: this._options.attachStacktrace,
});
event.level = level;
if (hint && hint.event_id) {
event.event_id = hint.event_id;
}
return SyncPromise.resolve(event);
}
}
public eventFromMessage(
message: string,
level: Severity = Severity.Info,
hint?: EventHint
): PromiseLike {
return this._browserBackend.eventFromMessage(message, level, hint);
}
}
public eventFromMessage(message: string, level: Severity = Severity.Info, hint?: EventHint): PromiseLike {
const event: Event = {
event_id: hint && hint.event_id,
level,
message,
};
return new SyncPromise(resolve => {
if (this._options.attachStacktrace && hint && hint.syntheticException) {
const stack = hint.syntheticException ? extractStackFromError(hint.syntheticException) : [];
parseStack(stack, this._options)
.then(frames => {
event.stacktrace = {
frames: prepareFramesForEvent(frames),
};
resolve(event);
})
fill(originalModule, level, function(originalConsoleLevel: () => any): any {
let sentryLevel: Severity;
switch (level) {
case 'debug':
sentryLevel = Severity.Debug;
break;
case 'error':
sentryLevel = Severity.Error;
break;
case 'info':
sentryLevel = Severity.Info;
break;
case 'warn':
sentryLevel = Severity.Warning;
break;
default:
sentryLevel = Severity.Log;
}
return function(): any {
if (getCurrentHub().getIntegration(Console)) {
getCurrentHub().addBreadcrumb(
{
category: 'console',
level: sentryLevel,
message: util.format.apply(undefined, arguments),
},