Skip to content

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

Merged
tim-smart merged 3 commits intoEffect-TS:mainfrom
luchersou:fix/pretty-logger-browser-source-maps
Mar 19, 2026
Merged

fix(logger): use source maps for error stack traces in browser pretty logger#6093
tim-smart merged 3 commits intoEffect-TS:mainfrom
luchersou:fix/pretty-logger-browser-source-maps

Conversation

@luchersou
Copy link
Contributor

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

🦋 Changeset detected

Latest commit: e3e1da8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 36 packages
Name Type
effect Patch
@effect/cli Patch
@effect/cluster Patch
@effect/experimental Patch
@effect/opentelemetry Patch
@effect/platform-browser Patch
@effect/platform-bun Patch
@effect/platform-node-shared Patch
@effect/platform-node Patch
@effect/platform Patch
@effect/printer-ansi Patch
@effect/printer Patch
@effect/rpc Patch
@effect/sql-clickhouse Patch
@effect/sql-d1 Patch
@effect/sql-drizzle Patch
@effect/sql-kysely Patch
@effect/sql-libsql Patch
@effect/sql-mssql Patch
@effect/sql-mysql2 Patch
@effect/sql-pg Patch
@effect/sql-sqlite-bun Patch
@effect/sql-sqlite-do Patch
@effect/sql-sqlite-node Patch
@effect/sql-sqlite-react-native Patch
@effect/sql-sqlite-wasm Patch
@effect/sql Patch
@effect/typeclass Patch
@effect/vitest Patch
@effect/workflow Patch
@effect/ai Patch
@effect/ai-amazon-bedrock Patch
@effect/ai-anthropic Patch
@effect/ai-google Patch
@effect/ai-openai Patch
@effect/ai-openrouter Patch

Not sure what this means? Click here to learn what changesets are.

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

@tim-smart tim-smart enabled auto-merge (squash) March 19, 2026 23:24
@tim-smart tim-smart merged commit a03b6a2 into Effect-TS:main Mar 19, 2026
11 checks passed
@github-project-automation github-project-automation bot moved this from Discussion Ongoing to Done in PR Backlog Mar 19, 2026
@github-actions github-actions bot mentioned this pull request Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

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

2 participants