Repository navigation
fix(nitro): skip default logging for expected evlog 4xx errors - #819
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
Contributor
|
Thank you for following the naming conventions! 🙏 |
@evlog/cli
evlog
@evlog/nuxthub
@evlog/signals
@evlog/telemetry
commit: |
This was referenced Oct 10, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs EVL-534. Closes #814.
Change
evlog's Nitro error handlers (
src/nitro/errorHandler.tsfor v2,src/nitro-v3/errorHandler.tsfor v3) call Nitro'sctx.defaultHandlerwhenever the dev overlay is not suppressed. In production that is always the case, so Nitro printed every throwncreateErroras[request error] [unhandled]with a stack dump, on top of the wide event evlog already writes.The handlers now skip
defaultHandlerwhen the error is anEvlogErrorwith a status below 500. The check lives in a newisExpectedEvlogErrorhelper insrc/nitro.ts. 5xxEvlogErrors and non-evlog errors are still logged by Nitro.Behavior change to review
The skip applies whatever the
devpreset, sodev: 'nitro'or'both'no longer shows Nitro's overlay for expected 4xxEvlogErrors either. Those errors are still in the wide event. If you want the overlay kept in dev, the check can be scoped to non-dev.Evidence
Unit tests
Regression test written first, run on
mainbefore the fix (test/nitro/errorHandler.test.ts, same case intest/nitro-v3/errorHandler.test.ts):After the fix: both files pass, 45 tests. The 5xx case passes before and after.
End to end (Nitro v2, production build)
Run in
apps/nitro-v2-playgroundwithNODE_ENV=production nitropack buildandnode .output/server/index.mjs, thenGET /api/test/error, which throwscreateError({ status: 400, why, fix, link }).On
main(038de6a):On this branch (3d3387e), same request:
No
[request error]line. The response body is identical in both runs.5xx check on this branch, using a temporary route that throws
createError({ status: 503 })(removed afterward): Nitro still prints[request error] [unhandled]with the stack, and the wide event is still written withstatusCode: 503.The playground prints
[evlog] ... called after the wide event was emittedwarnings in both runs. They come from the playground route and are unrelated to this change.Checks
pnpm run lint: passpnpm run typecheck: pass (afterdev:prepareforapps/telemetry; the first run failed there only because its.nuxtdirectory was missing)pnpm --filter evlog exec vitest run: 100 of 100 test files passpnpm --filter evlog buildNot verified
apps/nitro-v2-playground, not a full Nuxt app. The Nitro v3 handler is covered by unit tests only.ELI5
When a request fails for an expected reason, such as a declined card, evlog already writes one clear log line. Nitro, the server under Nuxt, was also printing a long "unhandled error" block for it. This change stops Nitro from printing that block for expected 4xx errors. Real server failures are still printed.