Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// There's always something that can go wrong with deserialization...
try {
const event = JSON.parse(serializedData);
getCurrentHub().addBreadcrumb(
{
category: 'sentry',
event_id: event.event_id,
level: event.level || Severity.fromString('error'),
message: getEventDescription(event),
},
{
event,
},
);
} catch (_oO) {
logger.error('Error while adding sentry type breadcrumb');
}
}
this._transport.sendEvent(event).then(null, reason => {
logger.error(`Error while sending event: ${reason}`);
});
}
}
if (!this._isEnabled()) {
logger.error('Trying to call showReportDialog with Sentry Client is disabled');
return;
}
const dsn = options.dsn || this.getDsn();
if (!options.eventId) {
logger.error('Missing `eventId` option in showReportDialog call');
return;
}
if (!dsn) {
logger.error('Missing `Dsn` option in showReportDialog call');
return;
}
const script = document.createElement('script');
script.async = true;
script.src = new API(dsn).getReportDialogEndpoint(options);
if (options.onLoad) {
script.onload = options.onLoad;
}
(document.head || document.body).appendChild(script);
}
}
public setupOnce(_addGlobalEventProcessor: (callback: EventProcessor) => void, getCurrentHub: () => Hub): void {
if (!this._app) {
logger.error('ExpressIntegration is missing an Express instance');
return;
}
instrumentMiddlewares(this._app, getCurrentHub);
}
}