Skip to content

Commit

Permalink
add missing file
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Oct 25, 2024
1 parent 15abee8 commit bcc5530
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Polyfill for `Error.captureStackTrace` in browsers
export function captureStackTrace(obj: any) {
const container = new Error()
Object.defineProperty(obj, 'stack', {
configurable: true,
get() {
const { stack } = container
Object.defineProperty(this, 'stack', { value: stack })
return stack
},
})
}

0 comments on commit bcc5530

Please sign in to comment.