From d8248c74c159419efb0b40d8739b81aff77f6ade Mon Sep 17 00:00:00 2001 From: Sunil Pai Date: Tue, 19 Apr 2022 18:18:14 +0100 Subject: [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 ``` --- .changeset/nice-dingos-fix.md | 17 +++++++++++++++++ packages/wrangler/src/dev/remote.tsx | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 .changeset/nice-dingos-fix.md diff --git a/.changeset/nice-dingos-fix.md b/.changeset/nice-dingos-fix.md new file mode 100644 index 000000000000..dee1bf678955 --- /dev/null +++ b/.changeset/nice-dingos-fix.md @@ -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 +``` diff --git a/packages/wrangler/src/dev/remote.tsx b/packages/wrangler/src/dev/remote.tsx index d5dc091ca051..0da7571d6557 100644 --- a/packages/wrangler/src/dev/remote.tsx +++ b/packages/wrangler/src/dev/remote.tsx @@ -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 () => {