Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public setupOnce(): void {
addGlobalEventProcessor(async (event: Event) => {
const self = getCurrentHub().getIntegration(DeviceContext);
if (!self) {
return event;
}
try {
// tslint:disable-next-line: no-unsafe-any
const deviceContexts = await RNSentry.deviceContexts();
event.contexts = { ...deviceContexts, ...event.contexts };
} catch (_Oo) {
// Something went wrong, we just continue
}
return event;
});
}
public setupOnce(): void {
this._handleUnhandledRejections();
this._handleOnError();
addGlobalEventProcessor((event: Event) => {
const self = getCurrentHub().getIntegration(ReactNative);
if (self) {
// getCurrentHub().configureScope(scope => {
// scope.addScopeListener();
// });
}
return event;
});
}
public setupOnce(): void {
// tslint:disable-next-line: cyclomatic-complexity
addGlobalEventProcessor(async (event: Event, hint?: EventHint) => {
const self = getCurrentHub().getIntegration(DebugSymbolicator);
// tslint:disable: strict-comparisons
if (!self || hint === undefined || hint.originalException === undefined) {
return event;
}
const reactError = hint.originalException as ReactNativeError;
// tslint:disable: no-unsafe-any
const parseErrorStack = require("react-native/Libraries/Core/Devtools/parseErrorStack");
const stack = parseErrorStack(reactError);
// Ideally this should go into contexts but android sdk doesn't support it
event.extra = {
...event.extra,
componentStack: reactError.componentStack,
public setupOnce(): void {
addGlobalEventProcessor((event: Event) => {
if (getCurrentHub().getIntegration(UserAgent)) {
if (!global.navigator || !global.location) {
return event;
}
// Request Interface: https://docs.sentry.io/development/sdk-dev/event-payloads/request/
const request = event.request || {};
request.url = request.url || global.location.href;
request.headers = request.headers || {};
request.headers['User-Agent'] = global.navigator.userAgent;
return {
...event,
request,
};
}
public setupOnce(): void {
addGlobalEventProcessor(async (event: Event) => {
const self = getCurrentHub().getIntegration(Release);
if (!self) {
return event;
}
try {
// tslint:disable-next-line: no-unsafe-any
const release = (await RNSentry.fetchRelease()) as {
build: string;
id: string;
version: string;
};
if (release) {
event.release = `${release.id}-${release.version}`;
event.dist = `${release.build}`;
}
public setupOnce(): void {
addGlobalEventProcessor((event: Event, hint?: EventHint) => {
const self = getCurrentHub().getIntegration(LinkedErrors);
if (self) {
return self._handler(event, hint);
}
return event;
});
}
public setupOnce(): void {
addGlobalEventProcessor((event: Event, hint?: EventHint) => {
const self = getCurrentHub().getIntegration(LinkedErrors);
if (self) {
return (self.handler(event, hint) as unknown) as PromiseLike;
}
return event;
});
}