I am working with a package called tymondesigns/jwt-auth in Laravel 5 and it generates exceptions like TokenExpiredException
, TokenInvalidException
and so on. I would like to catch these exceptions and return JSON responses for them. I have tried this in the Handler.php
file:
if ($e instanceof TokenExpiredException) {
return jsend()->error()
->message("Token has Expired")
->data([null])
->get();
}
But in vain. How to catch these exceptions and return JSON responses?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire