Skip to content

Commit

Permalink
fix: don't log an error when wrangler dev is cancelled early
Browse files Browse the repository at this point in the history
We currently log an `AbortError` with a stack if we exit `wrangler dev`'s startup process before it's done. This fix skips logging that error (since it's not an exception).

Test plan:

```
cd packages/wrangler
npm run build
cd ../../examples/workers-chat-demo
npx wrangler dev
# hit [x] as soon as the hotkey shortcut bar shows
```
  • Loading branch information
threepointone committed Apr 19, 2022
1 parent 4302172 commit d8248c7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .changeset/nice-dingos-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
"wrangler": patch
---

fix: don't log an error when `wrangler dev` is cancelled early

We currently log an `AbortError` with a stack if we exit `wrangler dev`'s startup process before it's done. This fix skips logging that error (since it's not an exception).

Test plan:

```
cd packages/wrangler
npm run build
cd ../../examples/workers-chat-demo
npx wrangler dev
# hit [x] as soon as the hotkey shortcut bar shows
```
4 changes: 3 additions & 1 deletion packages/wrangler/src/dev/remote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,9 @@ export function useWorker(props: {
start().catch((err) => {
// we want to log the error, but not end the process
// since it could recover after the developer fixes whatever's wrong
console.error("remote worker:", err);
if ((err as { code: string }).code !== "ABORT_ERR") {
console.error("remote worker:", err);
}
});

return () => {
Expand Down

0 comments on commit d8248c7

Please sign in to comment.