This bundle provides a way return JSON:API compatible error responses from REST endponts
Perfectly works along with FOS REST bundle configured to json response. OIn this case you will alway get response in a JSONAPI compatible format. https://jsonapi.org/format/#errors
$ composer require faecie/json-api-error-response ^0.1
You can configure the response of your exception in different ways:
- Implement interface
DescriptiveExceptionInterface
on your exception with only one method returning the array of Error objects - Configure each exception class in the bandle configuration
- Tag you service as
json_api.exception_describer
and implementExceptionDescriberInterface
on it with only one method allowing you to control how to serialize your exceptions