James Bannister • July 10, 2021 • 4 minute read In this post I want to show how we use Guzzle middleware with Guzzle and Laravel Http clients to catch 422 validation failures from external services and turn them into local validation failures. This approach can be used for catching other errors, and you'd just need to adjust it to cover your use case.
The validation rules are usually in sync, but occasionally there are rules that you cannot support in a different service.
So, from time to time, we have requests that will pass validation in the portal, but fail against the service due to one of these rules.