I have tried to define custom exception class in Laravel 5.3.But i couldn't find any solution.
How can i define and call custom exception class inside API controller in Laravel 5.3.Any help would be much appreciated..
Write a new CustomException class and extends the \Exception class:
CustomException extends \Exception {}
to use your custom exception class this is an example of use in controller:
public function someAction() {
throw new CustomException('your message error')
// or
try {
} catch (Exception $e) {
throw new CustomException($e->getMessage());
// ...
}
}