Throughout this chapter, we took a detailed look through the PHP error handling mechanism. PHP 7 made quite a cleanup of its error handling model by wrapping most of it under the Throwable
interface. This makes it possible to catch core errors via try...catch
blocks that were, prior to PHP 7, reserved for Exception
only. This leaves a bit of a terminology fuzz to digest now, as we come across Throwable
, Error
, Exception
, system-errors, user-errors, notices, warnings and alike. Speaking high level, we might say that any faulty state is error. More specifically, we now have throwables on one side and errors on the other. Throwables encompass thrown and catchable instances of Error
and Exception
, whereas, errors encompass basically anything not catchable as Throwable
.
Handling faulty states would not really be complete without proper logging. While the built-in error_log()
function provides enough to get us started, more robust solutions are available in the form of various third-party...