ShogunPanda/fastify-http-errors-enhanced

Other errors than 404?

Closed this issue · 2 comments

Only NotFound-errors are documented, but what about 400, 401, 403, 406, 500?
How do I throw those?

Thanks!

You can directly import and throw them.
Like:

import { ForbidenError} from 'http-errors-enhanced'

throw new ForbiddenError('No way')

Why do you say only NotFound is documented? Because is the only one showing in the README?

Wow that was FAST! Thanks for first class support!
I missed that this package was wrapping another one, "http-errors-enhanced", so the only error-type I found when browsing this code was the NotFoundError. But then I will look into the different variations of errors in the "http-errors-enhanced"-package.
Thanks once more, and for the examples.