Skip to content

Commit a14ee27

Browse files
committed
fix: dont capture bugs while replaying
1 parent 4b610ee commit a14ee27

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/index.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ export function useFlytrapFunction<
5555
_executionCursor++
5656
return output
5757
} catch (error) {
58+
if (getMode() === 'replay') {
59+
throw error
60+
}
5861
/**
5962
* Oops! We found a bug, let's send the current
6063
* executing function along with its data to the
@@ -112,6 +115,9 @@ export function useFlytrapFunction<
112115
_executionCursor++
113116
return output
114117
} catch (error) {
118+
if (getMode() === 'replay') {
119+
throw error
120+
}
115121
/**
116122
* Oops! We found a bug, let's send the current
117123
* executing function along with its data to the
@@ -205,6 +211,9 @@ export function useFlytrapCall<T>(fnOrNamespace: T, opts: FlytrapCallOptions): a
205211

206212
return output
207213
} catch (error) {
214+
if (getMode() === 'replay') {
215+
throw error
216+
}
208217
/**
209218
* Oops! We found a bug, let's send the current
210219
* executing function along with its data to the
@@ -244,6 +253,9 @@ export async function useFlytrapCallAsync<T extends (...args: any[]) => Promise<
244253

245254
return output
246255
} catch (error) {
256+
if (getMode() === 'replay') {
257+
throw error
258+
}
247259
/**
248260
* Oops! We found a bug, let's send the current
249261
* executing function along with its data to the

vite.config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export default defineConfig({
1010
useflytrap: fileURLToPath(new URL('./src/index.ts', import.meta.url).href)
1111
}
1212
},
13-
// @ts-expect-error
1413
test: {
1514
coverage: {
1615
'100': true,

0 commit comments

Comments
 (0)