chore: add test for middleware error handling (#1453)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { MiddlewareHandlerContext } from "$fresh/server.ts";
|
||||
|
||||
export async function handler(
|
||||
_req: Request,
|
||||
ctx: MiddlewareHandlerContext,
|
||||
) {
|
||||
try {
|
||||
ctx.state.flag = true;
|
||||
return await ctx.next();
|
||||
} catch (error) {
|
||||
console.log("we're very thoroughly dealing with this error here: " + error);
|
||||
throw Error("don't show the full error for security purposes");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user