Skip to content

Commit

Permalink
fix js
Browse files Browse the repository at this point in the history
  • Loading branch information
krystofwoldrich committed Jan 31, 2024
1 parent f3a779c commit 27ab160
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/js/integrations/rewriteframes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { RewriteFrames } from '@sentry/integrations';
import type { StackFrame } from '@sentry/types';
import type { Integration, StackFrame } from '@sentry/types';
import { Platform } from 'react-native';

import { isExpo, isHermesEnabled } from '../utils/environment';
Expand All @@ -13,7 +13,7 @@ export const IOS_DEFAULT_BUNDLE_NAME = 'app:///main.jsbundle';
* and removes file://, 'address at' prefixes, CodePush postfix,
* and Expo bundle postfix.
*/
export function createReactNativeRewriteFrames(): RewriteFrames {
export function createReactNativeRewriteFrames(): Integration {
return new RewriteFrames({
iteratee: (frame: StackFrame) => {
if (frame.platform === 'java' || frame.platform === 'cocoa') {
Expand Down
9 changes: 5 additions & 4 deletions src/js/sdk.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -216,15 +216,16 @@ export function captureUserFeedback(feedback: UserFeedback): void {
*
* @param callback that will be enclosed into push/popScope.
*/
export function withScope(callback: (scope: Scope) => void): ReturnType<Hub['withScope']> {
const safeCallback = (scope: Scope): void => {
export function withScope<T>(callback: (scope: Scope) => T): T | undefined {
const safeCallback = (scope: Scope): T | undefined => {
try {
callback(scope);
return callback(scope);
} catch (e) {
logger.error('Error while running withScope callback', e);
return undefined;
}
};
getCurrentHub().withScope(safeCallback);
return getCurrentHub().withScope(safeCallback);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/js/tracing/addTracingExtensions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Hub, Transaction } from '@sentry/core';
import type { Hub, Span, Transaction } from '@sentry/core';
import { addTracingExtensions, getCurrentHub, getMainCarrier } from '@sentry/core';
import type { CustomSamplingContext, Span, SpanContext, TransactionContext } from '@sentry/types';
import type { CustomSamplingContext, SpanContext, TransactionContext } from '@sentry/types';

import { DEFAULT } from '../tracing/ops';
import { ReactNativeTracing } from '../tracing/reactnativetracing';
Expand Down

0 comments on commit 27ab160

Please sign in to comment.