fastify / fastify-response-validation

A simple plugin that enables response validation for Fastify.
MIT License
53 stars 17 forks source link

refactor: use `@fastify/error` #123

Closed JacopoPatroclo closed 4 weeks ago

JacopoPatroclo commented 1 month ago

The aim of this PR is to address the issue https://github.com/fastify/fastify-response-validation/issues/121.

I’ve migrated the errors emitted by this plugin to use@fastify/error, which has enabled the creation of a utility function to check if the error is actually coming from this plugin by using the error code. This makes it easier for consumers to implement specific error-handling logic around it.

Checklist

JacopoPatroclo commented 4 weeks ago

Very good addition using @fastify/error. As I said in my comments, I'd personally leave the discussion about the opportunity of introducing isResponseValidationError to another pr.

I agree. I'll open a new PR with this feature if @mcollina is fine with exposing a new utility function for it. Meanwhile I think this one is now ready to be merged in.