Laravel CustomException class in Laravel

30% OFF - 9th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY9

Introduction

PHP Exceptions are thrown when an unprecedented event or error occurs.

As a rule of thumb, an exception should not be used to control the application logic such as if-statements and should be a subclass of the Exception class.

One main advantage of having all exceptions caught by a single class is that we are able to create custom exception handlers that return different response messages depending on the exception.



Got any Laravel Question?