Skip to content

fix(logger): use source maps for error stack traces in browser pretty logger#6093

Open
luchersou wants to merge 1 commit intoEffect-TS:mainfrom
luchersou:fix/pretty-logger-browser-source-maps
Open

fix(logger): use source maps for error stack traces in browser pretty logger#6093
luchersou wants to merge 1 commit intoEffect-TS:mainfrom
luchersou:fix/pretty-logger-browser-source-maps

Conversation

@luchersou
Copy link

Closes #6090

Problem

The prettyLoggerBrowser was passing the error as a string to console.error via Cause.pretty(...), which causes the browser to lose the reference to the original Error object and therefore can't resolve source maps.

Solution

Pass the actual Error objects alongside the formatted string using Cause.prettyErrors(cause), so the browser DevTools can resolve source maps correctly.

Before

554619120-b77932aa-645d-457e-b2db-d0b17d3f388b

After

error

Note

The current output shows both the formatted string from Cause.pretty and the _PrettyError objects, which results in the stack trace appearing twice.

I'm open to feedback on the preferred approach:

  1. Keep both (current fix) — preserves Effect's pretty formatting + source maps
  2. Pass only the Error objects — cleaner output, similar to the workaround shown in the issue

Happy to adjust based on maintainer preference!

@github-project-automation github-project-automation bot moved this to Discussion Ongoing in PR Backlog Feb 26, 2026
@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2026

⚠️ No Changeset found

Latest commit: c69da0a

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Discussion Ongoing

Development

Successfully merging this pull request may close these issues.

Pretty logger doesn't use source maps for error stack traces in the browser

1 participant