Skip to content

Commit dbad30a

Browse files
committed
fix(logging): log capture errors alongside human friendly errors
1 parent 72dfb83 commit dbad30a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/core/storage.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,13 @@ export const liveFlytrapStorage: FlytrapStorage = {
245245
)
246246

247247
if (captureError) {
248-
console.error('Capture error:')
249-
console.error(captureError)
250-
251248
const errorLog = createHumanLog({
252249
event: 'capture_failed',
253250
explanation: 'api_capture_error_response',
254251
solution: 'try_again_contact_us'
255252
})
256253
console.error(errorLog.toString())
254+
console.error(captureError)
257255
}
258256
}
259257
}

src/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function useFlytrapFunction<
7777
event: 'capture_failed',
7878
explanation: 'api_capture_error_response',
7979
solution: 'try_again_contact_us'
80-
})
80+
}).toString()
8181
)
8282
console.error(saveError)
8383
}
@@ -141,6 +141,7 @@ export function useFlytrapFunction<
141141
solution: 'try_again_contact_us'
142142
})
143143
console.error(errorLog.toString())
144+
console.error(saveError)
144145
}
145146

146147
throw error
@@ -382,6 +383,7 @@ export async function capture<T extends Error>({
382383
solution: 'try_again_contact_us'
383384
})
384385
console.error(errorLog.toString())
386+
console.error(saveError)
385387
}
386388
}
387389

0 commit comments

Comments
 (0)