Skip to content

Commit

Permalink
Translate stack traces in terminal and devtools
Browse files Browse the repository at this point in the history
  • Loading branch information
ssttevee committed Aug 14, 2023
1 parent 9d8509e commit 513ab63
Show file tree
Hide file tree
Showing 3 changed files with 311 additions and 117 deletions.
7 changes: 7 additions & 0 deletions .changeset/short-eggs-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"wrangler": patch
---

Improve source map support

Extends stack trace translations to terminal logs and DevTools console. Error stack traces logged to the terminal will show relative paths and should now be CTRL-clickable in VSCode. Error stack traces shown in Dev console should now link to the mapped source file in the Sources panel for `console.log`ed errors in addition to thrown errors.
7 changes: 6 additions & 1 deletion fixtures/worker-ts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,12 @@ export default {
ctx: ExecutionContext
): Promise<Response> {
const url = new URL(request.url);
if (url.pathname === "/error") throw new Error("Hello Error");
if (url.pathname === "/error") {
const err = new Error("Hello Error");
console.log(err);
console.log(err.stack);
throw err;
}
return new Response("Hello World!");
},
};
Loading

0 comments on commit 513ab63

Please sign in to comment.