We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
4.28.1
5.6.0
v20.16.0
macOS
14.6.1 (23G93)
This module exports a class at httpErrors.HttpError, so I should be able to write an errorHandler in fastify like this:
httpErrors.HttpError
errorHandler(error, _request, reply) { if (error instanceof httpErrors.HttpError) { return error; } return reply.internalServerError(); }
However, this doesn't type-check: httpErrors.HttpError is an interface in the type exports:
fastify-sensible/lib/httpError.d.ts
Lines 1 to 9 in 822ae7a
And you can't instanceof an interface, because it's a type, not a value. Most likely, HttpError should be a class.
instanceof
No response
The text was updated successfully, but these errors were encountered:
Can you provide a PR?
Sorry, something went wrong.
Yep, I'm trying to, it's turning out to be tricky to implement.
I have created a PR @Uzlopak Please review
Successfully merging a pull request may close this issue.
Prerequisites
Fastify version
4.28.1
Plugin version
5.6.0
Node.js version
v20.16.0
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
14.6.1 (23G93)
Description
This module exports a class at
httpErrors.HttpError
, so I should be able to write an errorHandler in fastify like this:However, this doesn't type-check:
httpErrors.HttpError
is an interface in the type exports:fastify-sensible/lib/httpError.d.ts
Lines 1 to 9 in 822ae7a
And you can't
instanceof
an interface, because it's a type, not a value. Most likely, HttpError should be a class.Link to code that reproduces the bug
No response
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: