- since we work with APIs built with
Laravelalmost daily - i have built this package to easily wrap the validation , NotFound , Internal Server Error exceptions which laravel might throw
- you can easily know which fields got rejected or have failed and there messages in case of validation
- in laravel debug mode extract the message easily with the stack trace
- also you can build your custom exception if needed
LaravelExceptionabstract class which will parse the laravel responseLValidationExceptionException for422status code use the constructor to create objectsLServerExceptionException for500status code use theparse(Map)factory to create objectsLNotFoundExceptionException for404status code use theparse(Map)factory to create objects
if(res.statusCode == 422){
throw LValidationException(res.data);
}else if(res.statusCode == 500){
throw LServerException.parse(res.data);
}else if(res.statusCode == 404){
throw LNotFoundException.parse(res.data);
}
- dio interceptor
- logs