https://github.com/nswbmw/hono-throw
A Hono middleware making it easy to throw HTTPException.
https://github.com/nswbmw/hono-throw
Last synced: about 1 month ago
JSON representation
A Hono middleware making it easy to throw HTTPException.
- Host: GitHub
- URL: https://github.com/nswbmw/hono-throw
- Owner: nswbmw
- Created: 2025-09-05T03:59:21.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2025-09-05T04:01:35.000Z (about 1 month ago)
- Last Synced: 2025-09-05T06:05:56.355Z (about 1 month ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.md
Awesome Lists containing this project
README
## hono-throw
A Hono middleware making it easy to throw HTTPException.
### Install
```sh
$ npm i hono-throw --save
```### Example
```js
import { Hono } from 'hono'
import { honoThrow } from 'hono-throw'
import { serve } from '@hono/node-server'const app = new Hono()
honoThrow(app) // or app.use(honoThrow())app.get('/', (c) => {
c.throw(400, 'error!!!')// Equivalent to:
// c.throw(400, { message: 'error!!!' })// Equivalent to:
// throw new HTTPException(400, { message: 'error!!!' })
})serve(app)
```### Test(100% coverage rate)
```sh
$ npm test
```### License
MIT