Skip to content

feat: improve dev terminal error output#370

Merged
HugoRCD merged 5 commits into
mainfrom
feat/pretty-terminal-errors
Jun 10, 2026
Merged

feat: improve dev terminal error output#370
HugoRCD merged 5 commits into
mainfrom
feat/pretty-terminal-errors

Conversation

@HugoRCD

@HugoRCD HugoRCD commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Pretty error rendering in development with structured terminal blocks, snippets, source locations, and wrapped “Why”/“Fix” guidance.
    • New dev terminal config (dev: 'evlog' | 'nitro' | 'both' | object) to choose overlay/pretty-error presets.
  • Bug Fixes

    • Nitro dev overlays can be suppressed to avoid duplicate displays; error handling now returns consistent JSON and avoids blocking HTTP responses.
  • Documentation

    • Updated docs and examples across config, Nuxt/Next integration, and structured errors.

@vercel

vercel Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
evlog-docs Ready Ready Preview, Comment, Open in v0 Jun 10, 2026 8:15pm
just-use-evlog Ready Ready Preview, Comment Jun 10, 2026 8:15pm

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Thank you for following the naming conventions! 🙏

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: eb201e40-5aad-4e2c-9663-d0050c50acdd

📥 Commits

Reviewing files that changed from the base of the PR and between bb22fe4 and 40f00d5.

📒 Files selected for processing (7)
  • apps/docs/content/2.learn/3.structured-errors.md
  • packages/evlog/src/nitro-v3/errorHandler.ts
  • packages/evlog/src/nitro/enrich-drain.ts
  • packages/evlog/src/nitro/errorHandler.ts
  • packages/evlog/src/shared/nitro-types.ts
  • packages/evlog/test/core/dev-terminal.test.ts
  • packages/evlog/test/nitro-v3/errorHandler.test.ts

📝 Walkthrough

Walkthrough

This PR adds comprehensive "pretty error" formatting for development terminal output. It introduces a dev-terminal configuration system (dev: 'evlog' | 'nitro' | 'both' or explicit object), propagates this through logger and Nitro runtime paths, implements error normalization and V8 stack parsing with snippet loading, and refactors Nitro error handlers to use shared helpers while supporting deferred background enrich+drain that doesn't block HTTP responses.

Changes

Pretty error flow across runtime, framework, and docs

Layer / File(s) Summary
Dev-terminal configuration types and resolution
packages/evlog/src/shared/dev-terminal.ts, packages/evlog/src/shared/nitroConfigBridge.ts, packages/evlog/src/types.ts, packages/evlog/src/nitro.ts
Introduces DevTerminalPreset and DevTerminalConfigObject types, resolveDevTerminal resolver with computed pretty-error defaults, and propagates dev through LoggerConfig, EvlogConfig, NitroModuleOptions, and NitroPluginEvlogConfig interfaces.
Pretty-error normalization, stack parsing, and snippet utilities
packages/evlog/src/shared/pretty-error.ts, packages/evlog/src/shared/pretty-error-snippet.node.ts, packages/evlog/src/shared/enrich-error-stack.node.ts
Adds normalizeErrorContext to extract structured error fields, parses V8 stacks into StackFrame[] with app/internal detection, picks primary frame for snippet context, reads disk-backed code snippets with fallback, builds tree-structured PrettyErrorTreeEntry[] with formatted guidance lines and hidden-frame summaries, and provides dev-only error stack enrichment via Nitro loadStackTrace.
Logger pretty output pipeline and EvlogError field extraction
packages/evlog/src/logger.ts
Initializes globalPrettyError configuration, dynamically imports and registers Node snippet reader, buffers pretty output lines via flushPrettyLines() to process.stdout in non-browser environments, refines tree child rendering to handle spacers and ANSI prefixes, and copies EvlogError structured fields (code, why, fix, link, status) into emitted error objects.
Shared enrich/drain orchestration with deferred drain and Cloudflare support
packages/evlog/src/nitro/enrich-drain.ts
Extracts safe request/response headers and computes HTTP status with fallback order, implements extendDeferredDrain to prevent rejections and optionally register Cloudflare waitUntil callbacks, exports callEnrichAndDrain to orchestrate evlog:enrich and evlog:drain hook execution with optional background deferral.
Nitro plugin error hook with guarded emission and deferred background enrich/drain
packages/evlog/src/nitro/plugin.ts
Registers pretty-error snippet reader and includes dev config in initLogger, refactors error hook to set _evlogEmitting guard, enrich stack for dev, emit/keep events, then invoke callEnrichAndDrain with deferDrain: true as fire-and-forget; updates afterResponse hook to skip when _evlogEmitting is set.
Nitro v3 plugin with deferDrain option and background enrich/drain
packages/evlog/src/nitro-v3/plugin.ts
Extends callDrainHook and callEnrichAndDrain with optional deferDrain parameter to schedule drain via extendDeferredDrain or Cloudflare waitUntil; registers pretty-error snippet reader and dev config in initialization; updates error/response hook guards for _evlogEmitting flag.
Refactored Nitro error handlers with shared helpers and optional default-handler delegation
packages/evlog/src/nitro/errorHandler.ts, packages/evlog/src/nitro-v3/errorHandler.ts
Converts both handlers to async with optional NitroErrorHandlerContext providing defaultHandler, conditionally suppresses Nitro dev overlay, always marks H3 error as handled, uses buildPlainNitroErrorBody for non-EvlogError throws, derives HTTP status, and returns JSON responses.
Nitro H3 error handling and response building utilities
packages/evlog/src/nitro.ts
Exports markH3ErrorHandled, prependNitroErrorHandler (prepends handler chain-safely), shouldSuppressNitroDevOverlay (caches suppression decisions), resetNitroDevOverlayCache (test-only), suppressNitroDevOverlay (clears error flags), and buildPlainNitroErrorBody (sanitizes 5xx production messages).
Module integration: prepending error handlers in Nuxt and Nitro
packages/evlog/src/nitro/module.ts, packages/evlog/src/nitro-v3/module.ts, packages/evlog/src/nuxt/module.ts
Updates all three modules to unconditionally prepend evlog's error handler via prependNitroErrorHandler helper; Nuxt module extends ModuleOptions with dev config and prepends in nitro:config hook.
Tests for dev-terminal resolution, pretty-error utilities, and stack enrichment
packages/evlog/test/core/dev-terminal.test.ts, packages/evlog/test/core/pretty-error.test.ts
Covers resolveDevTerminal preset/unknown-value behavior, shouldShowFrameworkOverlay defaults, pretty-error normalization/stack parsing/frame picking/snippet loading/entry building with formatting validation, and enrichErrorStackForDev behavior outside pretty dev mode.
Error handler, plugin enrichment, and config bridge tests
packages/evlog/test/nitro/errorHandler.test.ts, packages/evlog/test/nitro-v3/errorHandler.test.ts, packages/evlog/test/nitro/plugin-enrichment.test.ts, packages/evlog/test/shared/nitroConfigBridge.test.ts, packages/evlog/test/nitro/plugin.test.ts
Updates error handler tests to async invocation, overlay suppression, defaultHandler delegation, and JSON response validation; adds Nitro v3 handler tests; refactors plugin enrichment to use shared callEnrichAndDrain with deferDrain behavior; adds sync config bridge read test; updates plugin emission guards.
Documentation and changeset updates for dev terminal behavior
.changeset/pretty-terminal-errors.md, apps/docs/content/2.learn/2.wide-events.md, apps/docs/content/2.learn/3.structured-errors.md, apps/docs/content/6.reference/1.configuration.md, apps/docs/content/3.integrate/frameworks/01.nuxt.md, apps/docs/content/3.integrate/frameworks/02.nextjs.md
Documents dev-terminal output examples, dev preset/object configuration options, framework overlay behavior, structured error rendering with source location and guidance, and configuration reference with new dev field and "Dev terminal output" section.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • HugoRCD/evlog#340: Changes to nitro config bridge behavior overlap with this PR's runtime config probing and dev-terminal propagation.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is empty. The template requires at least a description of changes, rationale, and checklist confirmation, but none were provided. Add a description explaining the changes, why they were made, and confirm the documentation update checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title 'feat: improve dev terminal error output' clearly describes the main change—adding enhanced pretty error rendering for development terminal output with better formatting and configuration options.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/pretty-terminal-errors

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@pkg-pr-new

pkg-pr-new Bot commented Jun 9, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/evlog@370
npm i https://pkg.pr.new/@evlog/nuxthub@370

commit: 40f00d5

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/evlog/test/nitro/plugin-enrichment.test.ts (1)

18-57: 🛠️ Refactor suggestion | 🟠 Major | 🏗️ Heavy lift

These tests are exercising a clone of the production helper.

Lines 18-57 reimplement callEnrichAndDrain instead of invoking the real Nitro helper, so the new deferDrain assertions can stay green even if packages/evlog/src/nitro/plugin.ts changes, regresses, or wires hooks differently. Please extract the runtime helper into an importable module or drive the registered Nitro hooks from the test instead. As per coding guidelines, "Always import real source helpers in tests, never re-implement them in tests."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/evlog/test/nitro/plugin-enrichment.test.ts` around lines 18 - 57,
Tests reimplement the production helper callEnrichAndDrain instead of using the
real runtime helper, causing brittle duplicates; replace the inline
implementation by importing and using the shared helper from the production code
(e.g., the runtime helper that invokes nitro hooks and handles deferDrain in
packages/evlog/src/nitro/plugin.ts) or, alternatively, instantiate the real
Nitro plugin and drive the registered hooks ('evlog:enrich' and 'evlog:drain')
from the test so assertions exercise production behavior; update the test to
call the imported helper (or trigger nitroApp.hooks.callHook via the actual
plugin) and remove the local callEnrichAndDrain function.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/evlog/src/nitro-v3/plugin.ts`:
- Around line 278-280: The code currently sets ctx._evlogEmitted true before
running enrichErrorStackForDev, the evlog:emit:keep hook, runner.runKeep, and
log.emit(), so any exception there prevents the response fallback; change this
so the flag is only set after the keep/emit pipeline completes successfully: use
a temporary local "emitting" boolean or an emittedAfterSuccess variable inside
the same scope, run enrichErrorStackForDev(), trigger the evlog:emit:keep hook
and runner.runKeep(), call log.emit(), and only if all of those succeed set
ctx._evlogEmitted = true (apply the same change to the similar block around the
evlog emission at lines ~305-310). Ensure exceptions propagate normally if emit
fails so the response fallback can run.
- Around line 109-115: The deferDrain branch currently fire-and-forgets
drainPromise (options?.deferDrain) which prevents Nitro v3 from registering the
promise with the runtime; instead, when deferDrain is true and a waitUntil API
is available (e.g. event.req?.waitUntil or event?.req?.waitUntil), call that API
with drainPromise so Nitro/platform can keep the promise alive, and still attach
a .catch to log failures; likewise, ensure callEnrichAndDrain forwards options
into callDrainHook so callDrainHook can call event.req.waitUntil(drainPromise)
when available, and update the v3 error-hook call site (where callEnrichAndDrain
is currently invoked with void ... .catch(...)) to register the returned promise
with event.req.waitUntil when possible rather than discarding it.

In `@packages/evlog/src/nitro.ts`:
- Around line 164-166: The current branch in nitro.ts that handles
Array.isArray(errorHandler) only de-duplicates and returns the array unchanged
when it already contains handlerPath, which leaves handlerPath in its original
position; change this so that if errorHandler is an array and includes
handlerPath you remove any existing occurrences and return a new array with
handlerPath forced to the front (e.g., [handlerPath, ...otherHandlers])
otherwise if it does not include handlerPath return [handlerPath,
...errorHandler]; operate on errorHandler and handlerPath identifiers so Evlog
is always positioned first in the chain.

In `@packages/evlog/src/nitro/plugin.ts`:
- Around line 228-229: The flag e.context._evlogEmitted is being set before the
emit pipeline completes, which can mark requests as emitted even if later steps
throw; change the logic in the emit flow (the block that calls
enrichErrorStackForDev, emits the evlog:emit:keep hook, runner.runKeep, and
requestLog.emit()) so that you either use a separate in-progress flag (e.g.,
e.context._evlogEmitting) at the start and only set e.context._evlogEmitted =
true after requestLog.emit() resolves successfully, or move the assignment to
immediately after the successful requestLog.emit() call; apply the same fix to
the other similar blocks referenced around the existing occurrences (the other
emit branches where _evlogEmitted is set currently).
- Around line 112-121: The deferDrain branch currently fire-and-forgets
drainPromise (drainPromise.catch(...)) which can drop background drains when
invoked from Nitro's non-awaited error hook; update the logic in the deferDrain
handling in packages/evlog/src/nitro/plugin.ts so that when callEnrichAndDrain
is used from the error hook it attaches the drain promise to the request/event
lifetime (use event.waitUntil or ctx.waitUntil if available) instead of
unconditionally void-ing it; if the runtime cannot guarantee background work
outliving the response then fall back to using waitUntil, and only use the
current void+catch approach when you detect a runtime that guarantees background
tasks will outlive the response (or when no event/ctx is present). Ensure you
reference and update the call site callEnrichAndDrain(..., { deferDrain: true })
to pass the event/ctx into the drain handler so it can call
event.waitUntil(ctx.waitUntil) with drainPromise, while retaining the existing
drainPromise.catch(...) fallback.

In `@packages/evlog/src/nuxt/module.ts`:
- Around line 383-384: resolver.resolve(...) can return platform-native path
separators which break Nitro's errorHandler string on Windows; update the code
around resolver.resolve('../nitro/errorHandler') so evlogHandler is normalized
to POSIX-style separators before passing into prependNitroErrorHandler and
assigning nitroConfig.errorHandler (i.e., normalize the result of
resolver.resolve into a forward-slash path and then call
prependNitroErrorHandler(evlogHandlerNormalized, ...) / assign
nitroConfig.errorHandler using the normalized value).

In `@packages/evlog/src/shared/pretty-error.ts`:
- Line 75: The SKIP_FRAME_PATH_RE currently treats any path containing
"/error.ts" or "/error.mjs" as internal which incorrectly filters user files;
update SKIP_FRAME_PATH_RE so the error\.(ts|mjs) fragment is only matched when
preceded by evlog-specific path segments (for example require the same
(?:packages[/\\]evlog|evlog[/\\](?:dist|src)) prefix before error\.(?:ts|mjs)),
or split into two checks: one regex for evlog package paths and a separate
stricter check for an evlog error file, ensuring SKIP_FRAME_PATH_RE only
excludes frames that are definitely inside evlog (reference: SKIP_FRAME_PATH_RE
constant in pretty-error.ts).

---

Outside diff comments:
In `@packages/evlog/test/nitro/plugin-enrichment.test.ts`:
- Around line 18-57: Tests reimplement the production helper callEnrichAndDrain
instead of using the real runtime helper, causing brittle duplicates; replace
the inline implementation by importing and using the shared helper from the
production code (e.g., the runtime helper that invokes nitro hooks and handles
deferDrain in packages/evlog/src/nitro/plugin.ts) or, alternatively, instantiate
the real Nitro plugin and drive the registered hooks ('evlog:enrich' and
'evlog:drain') from the test so assertions exercise production behavior; update
the test to call the imported helper (or trigger nitroApp.hooks.callHook via the
actual plugin) and remove the local callEnrichAndDrain function.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: d609913f-0d62-4c9f-9231-80ea1c3c4375

📥 Commits

Reviewing files that changed from the base of the PR and between 0c6cb24 and d6d169d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (27)
  • .changeset/pretty-terminal-errors.md
  • apps/docs/content/2.learn/2.wide-events.md
  • apps/docs/content/2.learn/3.structured-errors.md
  • apps/docs/content/3.integrate/frameworks/01.nuxt.md
  • apps/docs/content/3.integrate/frameworks/02.nextjs.md
  • apps/docs/content/6.reference/1.configuration.md
  • apps/playground/app/components/playground/TestCard.vue
  • apps/playground/app/composables/useTestRunner.ts
  • apps/playground/app/composables/useTestState.ts
  • apps/playground/app/config/tests.config.ts
  • packages/evlog/src/logger.ts
  • packages/evlog/src/nitro-v3/errorHandler.ts
  • packages/evlog/src/nitro-v3/module.ts
  • packages/evlog/src/nitro-v3/plugin.ts
  • packages/evlog/src/nitro.ts
  • packages/evlog/src/nitro/errorHandler.ts
  • packages/evlog/src/nitro/module.ts
  • packages/evlog/src/nitro/plugin.ts
  • packages/evlog/src/nuxt/module.ts
  • packages/evlog/src/shared/define.ts
  • packages/evlog/src/shared/enrich-error-stack.node.ts
  • packages/evlog/src/shared/pretty-error-snippet.node.ts
  • packages/evlog/src/shared/pretty-error.ts
  • packages/evlog/src/types.ts
  • packages/evlog/test/core/pretty-error.test.ts
  • packages/evlog/test/nitro/errorHandler.test.ts
  • packages/evlog/test/nitro/plugin-enrichment.test.ts

Comment thread packages/evlog/src/nitro-v3/plugin.ts Outdated
Comment thread packages/evlog/src/nitro-v3/plugin.ts Outdated
Comment thread packages/evlog/src/nitro.ts
Comment thread packages/evlog/src/nitro/plugin.ts Outdated
Comment thread packages/evlog/src/nitro/plugin.ts Outdated
Comment thread packages/evlog/src/nuxt/module.ts Outdated
Comment thread packages/evlog/src/shared/pretty-error.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/evlog/src/nitro/errorHandler.ts (1)

23-25: 🧹 Nitpick | 🔵 Trivial | ⚡ Quick win

Extract shared NitroErrorHandlerContext type.

The NitroErrorHandlerContext type is duplicated in both packages/evlog/src/nitro/errorHandler.ts and packages/evlog/src/nitro-v3/errorHandler.ts. Consider extracting it to a shared location (e.g., packages/evlog/src/nitro.ts or a new packages/evlog/src/shared/nitro-types.ts) to follow DRY principles.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/evlog/src/nitro/errorHandler.ts` around lines 23 - 25, Extract the
duplicated NitroErrorHandlerContext type into a shared module (e.g., create
packages/evlog/src/shared/nitro-types.ts or packages/evlog/src/nitro.ts), export
the type from that module, and update both errorHandler.ts files
(packages/evlog/src/nitro/errorHandler.ts and
packages/evlog/src/nitro-v3/errorHandler.ts) to import NitroErrorHandlerContext
from the new shared location; ensure the exported type signature matches the
original (including defaultHandler signature) and run type checks to confirm no
other references need updating.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/docs/content/2.learn/3.structured-errors.md`:
- Line 229: The table cell containing the text "`dev: 'evlog'` (default when
`pretty: true` in dev)" is awkwardly phrased; update that parenthetical to a
clearer form such as "default in pretty dev" or "(default in pretty development
mode)" so it reads e.g. "`dev: 'evlog'` (default in pretty dev)"; locate and
edit the exact string "`dev: 'evlog'` (default when `pretty: true` in dev)" in
the file (apps/docs/content/2.learn/3.structured-errors.md) and replace it with
the chosen clearer wording.

In `@packages/evlog/src/nitro/enrich-drain.ts`:
- Around line 101-117: Wrap runner.runEnrich in a try/catch so an enrich
exception doesn't prevent draining (use runner.hasEnrich before calling
runner.runEnrich and log or handle the error inside the catch), and ensure
runner.runDrain is added to drainTasks with a rejection handler like the hook
call (i.e., push runner.runDrain(drainCtx).catch(...)) or use Promise.allSettled
on drainTasks later so any rejection from runner.runDrain (or the hook) doesn't
propagate to the caller; update references: runner.hasEnrich, runner.runEnrich,
runner.hasDrain, runner.runDrain, and nitroApp.hooks.callHook('evlog:drain',
drainCtx) accordingly.

In `@packages/evlog/src/nitro/errorHandler.ts`:
- Line 27: The handler signature passed to defineNitroErrorHandler must reflect
Nitro's contract: allow async/MaybePromise returns and accept a context object
where defaultHandler is required; update the function signature/export so the
third parameter uses the correct NitroErrorHandlerContext type (not optional)
and ensure the handler return type permits Promise (i.e., keep async or use
MaybePromise), and remove any optional/undefined typing for ctx.defaultHandler
so callers and implementations treat defaultHandler as present.

In `@packages/evlog/test/core/dev-terminal.test.ts`:
- Around line 12-65: Add a new unit test for the object-form dev config to cover
the code path in resolveDevTerminal that accepts an object: call
resolveDevTerminal with dev set to an object (e.g., { frameworkOverlay: true,
prettyError: { snippet: false, stackDepth: 1, compact: false, detail: 'guidance'
} }) while NODE_ENV is 'development' and assert the returned frameworkOverlay
and prettyError match the provided object (use the same test file and pattern as
existing tests in dev-terminal.test.ts and reference the resolveDevTerminal
function).

In `@packages/evlog/test/nitro-v3/errorHandler.test.ts`:
- Around line 10-39: Add tests to bring nitro-v3 errorHandler coverage in line
with the v2 suite: extend packages/evlog/test/nitro-v3/errorHandler.test.ts to
include cases for EvlogError serialization with data fields, deriving status
from error.cause and default status handling, excluding internal context from
serialized output, sanitizing production messages differently for 5xx vs 4xx,
verifying H3 event _handled flag behavior, and testing overlay suppression via
resetNitroDevOverlayCache; target the errorHandler function in these tests and
reuse helpers from the v2 tests as needed so the same behaviors are asserted for
the v3 implementation.

---

Outside diff comments:
In `@packages/evlog/src/nitro/errorHandler.ts`:
- Around line 23-25: Extract the duplicated NitroErrorHandlerContext type into a
shared module (e.g., create packages/evlog/src/shared/nitro-types.ts or
packages/evlog/src/nitro.ts), export the type from that module, and update both
errorHandler.ts files (packages/evlog/src/nitro/errorHandler.ts and
packages/evlog/src/nitro-v3/errorHandler.ts) to import NitroErrorHandlerContext
from the new shared location; ensure the exported type signature matches the
original (including defaultHandler signature) and run type checks to confirm no
other references need updating.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 82c07dcf-103c-4946-aa62-b78db2f089e5

📥 Commits

Reviewing files that changed from the base of the PR and between d6d169d and d8a8a2d.

📒 Files selected for processing (25)
  • .changeset/pretty-terminal-errors.md
  • apps/docs/content/2.learn/3.structured-errors.md
  • apps/docs/content/3.integrate/frameworks/01.nuxt.md
  • apps/docs/content/6.reference/1.configuration.md
  • apps/playground/server/api/test/structured-error.get.ts
  • packages/evlog/src/logger.ts
  • packages/evlog/src/nitro-v3/errorHandler.ts
  • packages/evlog/src/nitro-v3/plugin.ts
  • packages/evlog/src/nitro.ts
  • packages/evlog/src/nitro/enrich-drain.ts
  • packages/evlog/src/nitro/errorHandler.ts
  • packages/evlog/src/nitro/plugin.ts
  • packages/evlog/src/nuxt/module.ts
  • packages/evlog/src/shared/define.ts
  • packages/evlog/src/shared/dev-terminal.ts
  • packages/evlog/src/shared/nitroConfigBridge.ts
  • packages/evlog/src/shared/pretty-error.ts
  • packages/evlog/src/types.ts
  • packages/evlog/test/core/dev-terminal.test.ts
  • packages/evlog/test/core/pretty-error.test.ts
  • packages/evlog/test/nitro-v3/errorHandler.test.ts
  • packages/evlog/test/nitro/errorHandler.test.ts
  • packages/evlog/test/nitro/plugin-enrichment.test.ts
  • packages/evlog/test/nitro/plugin.test.ts
  • packages/evlog/test/shared/nitroConfigBridge.test.ts

Comment thread apps/docs/content/2.learn/3.structured-errors.md Outdated
Comment thread packages/evlog/src/nitro/enrich-drain.ts
Comment thread packages/evlog/src/nitro/errorHandler.ts Outdated
Comment thread packages/evlog/test/core/dev-terminal.test.ts
Comment thread packages/evlog/test/nitro-v3/errorHandler.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
apps/docs/content/2.learn/3.structured-errors.md (1)

232-232: 🧹 Nitpick | 🔵 Trivial | 💤 Low value

Phrasing could be simplified for consistency.

The parenthetical "(default when pretty: true in dev)" is verbose. Consider "default in pretty dev" or "(default in pretty development mode)" for consistency with the changeset and configuration docs.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/docs/content/2.learn/3.structured-errors.md` at line 232, Simplify the
parenthetical in the table row containing "`dev: 'evlog'` (default when `pretty:
true` in dev)`" by replacing "(default when `pretty: true` in dev)" with a more
concise phrase such as "(default in pretty dev)" or "(default in pretty
development mode)"; update the markdown table cell that includes the `dev:
'evlog'` and `pretty: true` text to use the chosen concise wording for
consistency with the changeset and configuration docs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@apps/docs/content/2.learn/3.structured-errors.md`:
- Line 232: Simplify the parenthetical in the table row containing "`dev:
'evlog'` (default when `pretty: true` in dev)`" by replacing "(default when
`pretty: true` in dev)" with a more concise phrase such as "(default in pretty
dev)" or "(default in pretty development mode)"; update the markdown table cell
that includes the `dev: 'evlog'` and `pretty: true` text to use the chosen
concise wording for consistency with the changeset and configuration docs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b01d86f1-2e31-4da7-8a8f-9bf36350bf27

📥 Commits

Reviewing files that changed from the base of the PR and between d8a8a2d and bb22fe4.

📒 Files selected for processing (5)
  • apps/docs/content/2.learn/2.wide-events.md
  • apps/docs/content/2.learn/3.structured-errors.md
  • apps/docs/content/3.integrate/frameworks/02.nextjs.md
  • packages/evlog/src/nitro/plugin.ts
  • packages/evlog/test/core/pretty-error.test.ts
💤 Files with no reviewable changes (1)
  • packages/evlog/src/nitro/plugin.ts

@HugoRCD HugoRCD merged commit 6dc352d into main Jun 10, 2026
18 checks passed
@HugoRCD HugoRCD deleted the feat/pretty-terminal-errors branch June 10, 2026 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant