You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{serve}from'@hono/node-server';import{Hono}from'hono';import{every,some}from'hono/combine';constmiddleware=every(some(async(_,next)=>{console.log('middleware 1');awaitnext();},async(_,next)=>{console.log('middleware 2','should not be called');// 👈️ Called after "error thrown"awaitnext();}),()=>{console.log('error thrown');thrownewError('some error');});constapp=newHono();app.use(middleware);app.get('/',(c)=>{returnc.text('ok');});serve(app);
What is the expected behavior?
middleware 2 should be skipped.
What do you see instead?
middleware 2 called after "error thrown".
Additional information
This issue is also reproducible with the following code. It seems that middleware skipped by some() is called later, regardless of whether every() is used.
constmiddleware: MiddlewareHandler=async(c,_next)=>{awaitsome(async(_,next)=>{console.log('middleware 1');awaitnext();},async(_,next)=>{console.log('middleware 2','should not be called');awaitnext();})(c,async()=>{console.log('error thrown');thrownewError('some error');});};
The text was updated successfully, but these errors were encountered:
What version of Hono are you using?
4.7.0
What runtime/platform is your app running on? (with version if possible)
Node.js
What steps can reproduce the bug?
Here is a reproducible example:
https://stackblitz.com/edit/node-dtmqxwzv?file=index.ts
What is the expected behavior?
middleware 2
should be skipped.What do you see instead?
middleware 2
called after "error thrown".Additional information
This issue is also reproducible with the following code. It seems that middleware skipped by some() is called later, regardless of whether every() is used.
The text was updated successfully, but these errors were encountered: