Skip to content

Commit

Permalink
Update debugger.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Jun 18, 2024
1 parent 7b9fe84 commit bf45791
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/runtime/debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ Bun implements the [V8 Stack Trace API](https://v8.dev/docs/stack-trace-api), wh

##### Error.prepareStackTrace

The `Error.prepareStackTrace` function is a global function that lets you customize the stack trace output. This function is called with the error object and an array of `CallSite` objects and lets you return a custom stack trace.

```ts
Error.prepareStackTrace = (err, stack) => {
return stack.map(callSite => {
Expand All @@ -238,8 +240,6 @@ console.log(err.stack);
// [ "error.js" ]
```

This formerly V8-only API lets you customize the stack trace output by providing a custom `prepareStackTrace` function on the `Error` object. This function is called with the error object and an array of `CallSite` objects and lets you return a custom stack trace.

##### Error.captureStackTrace(error, startFn)

The `Error.captureStackTrace` lets you capture a stack trace at a specific point in your code, rather than at the point where the error was thrown.
Expand Down

0 comments on commit bf45791

Please sign in to comment.