{{ message }}
Repository navigation
Conversation
v1rtl
force-pushed
the
fix/render-error-next
branch
2 times, most recently
from
October 20, 2026 10:34
5e08459 to
4ec3971
Compare
res.render threw the error reported by the template engine. An engine calling back asynchronously made it an uncaught exception outside of any handler. The error is now passed to next(), so it reaches the app's error handler, the same way as express.
v1rtl
force-pushed
the
fix/render-error-next
branch
from
October 20, 2026 10:39
4ec3971 to
d0c2016
Compare
This branch has not been 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.

The bug
res.renderrendered with a callback that threw the error the template engine reported:That works when the engine calls back synchronously, since the throw unwinds into the handler and
applyHandlercatches it. Many engines call back asynchronously though, e.g. after reading the template file, and then the error is thrown outside of any handler. It surfaced as an uncaught exception, which terminates the process by default, and the request never got a response.The fix
res.renderpasses the error tonext(), so it reaches the app's error handler like any other error. This matches express, whose defaultres.rendercallback callsreq.next(err).renderTemplatetakesnextas a new optional last argument,extendMiddlewarepasses it. Without it the error is still thrown, so direct callers ofrenderTemplatebehave as before.Tests
tests/core/app.test.ts, newres.rendersuite: