import { HTTPException } from "https://deno.land/x/hono@v4.2.8/mod.ts";
HTTPException
must be used when a fatal error such as authentication failure occurs.
Examples
Example 1
Example 1
import { HTTPException } from 'hono/http-exception'
// ...
app.post('/auth', async (c, next) => {
// authentication
if (authorized === false) {
throw new HTTPException(401, { message: 'Custom error message' })
}
await next()
})
Properties
readonly
optional
res: Response