-
-
Notifications
You must be signed in to change notification settings - Fork 363
Open
Labels
bugSomething isn't workingSomething isn't working
Description
What version of Elysia is running?
1.3.20
What platform is your computer?
Linux 6.14.0-28-generic x86_64 x86_64
What environment are you using
bun: 1.2.20
Are you using dynamic mode?
Not set. When it is set to false
, the issue does not occur.
What steps can reproduce the bug?
import { Elysia } from "elysia";
export const app = new Elysia()
.onError(() => {
console.log("handle");
return "return data";
})
.onAfterResponse(() => {
console.log("logging");
})
.get("/test", () => {
throw new Error("err");
})
.listen(3000);
What is the expected behavior?
onAfterResponse
should be called even when an error is thrown manually.
curl http://localhost:3000/404 # Both `handle` and `logging` are shown
curl http://localhost:3000/test # Both `handle` and `logging` are shown
What do you see instead?
When requesting an unregistered path, both onError
and onAfterResponse
are called, but when an error is thrown manually, onAfterResponse
is not called.
curl http://localhost:3000/404 # Both `handle` and `logging` are shown
curl http://localhost:3000/test # Only `handle` is shown
Additional information
No response
Have you try removing the node_modules
and bun.lockb
and try again yet?
yes
leddy231, freehour, nzws, tobias-edwards, AABB2741 and 2 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working