Skip to content

Conversation

penalosa
Copy link
Contributor

Fixes DEVX-2213

Previously, the formatMessage utility was heavily used across the Wrangler codebase to nicely format ParseError-style error messages. This led to nice display, but had two problems:

  • It was used via logger.log(formatMessage(...)), which meant that a large chunk of Wrangler's error messages were shoing up in stdout rather than stderr
  • It needed to be used intentionally, which meant that in various places we logged out a potentional ParseError without applying the formatting (leading to hard to understand stack traces being shown to users when e.g. a preview session failed)

Now, logger.error() will automatically apply formatMessage() when the first argument is a ParseError


  • Tests
    • Tests included
    • Tests not necessary because:
  • Public documentation
    • Cloudflare docs PR(s):
    • Documentation not necessary because: internal refactor
  • Wrangler V3 Backport
    • Wrangler PR:
    • Not necessary because:

@penalosa penalosa requested review from a team as code owners September 23, 2025 14:06
Copy link

changeset-bot bot commented Sep 23, 2025

⚠️ No Changeset found

Latest commit: 65f5cdd

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

*/
export function isAbortError(err: unknown) {
const legacyAbortErroCheck = (err as { code: string }).code !== "ABORT_ERR";
const legacyAbortErroCheck = (err as { code: string }).code == "ABORT_ERR";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a bug. As such, I've changed this equality check, and inverted the callsites of isAbortError(), which seems to make more sense to me.

Copy link

pkg-pr-new bot commented Sep 23, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@10734

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@10734

miniflare

npm i https://pkg.pr.new/miniflare@10734

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@10734

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@10734

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@10734

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@10734

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@10734

wrangler

npm i https://pkg.pr.new/wrangler@10734

commit: 65f5cdd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Untriaged
Development

Successfully merging this pull request may close these issues.

1 participant