Laravel – Vuejs – Axios – Capturing Validation error

A quick snippet on how to capture Laravel's 422 error on the front-end.


Capturing Laravel’s Error On Axios

Axios is a promised based http client.  Capturing laravel's 422 status error is a bit tricky because the returned data is a dynamic json key.  Here is a simple approach on how we can capture the error status code and throw an error using sweet alert 2.