Tutorial by Topics: customexception

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.

Page 1 of 1