diff --git a/src/lib/sentry.ts b/src/lib/sentry.ts index 1b5a11f..8a24046 100644 --- a/src/lib/sentry.ts +++ b/src/lib/sentry.ts @@ -69,7 +69,20 @@ export const setUserContext = (userId: string, brandId?: string) => { }); }; -// Export for transaction tracing -export const startTransaction = (name: string, op: string = "custom") => { - return Sentry.startTransaction({ name, op }); -}; \ No newline at end of file +// Export for transaction tracing - simplified wrapper +export async function withTransaction( + name: string, + op: string, + fn: () => Promise +): Promise { + return Sentry.withScope(async (scope) => { + scope.setTransactionName(name); + try { + const result = await fn(); + return result; + } catch (error) { + Sentry.captureException(error); + throw error; + } + }); +} \ No newline at end of file