Stop Silencing Exceptions in PHP

Correct exception handling is important for easy debugging! See how to throw and re-throw exceptions to avoid headaches.

.com software
3 min readDec 16, 2022
A woman’s mouth covered by her index finger
Image by Malik Skydsgaard

About exceptions

Exception handling is a fundamental concept in programming that refers to the process of responding to and resolving unexpected errors or exceptions that may occur during the execution of a program.

A wide range of factors causes exceptions. These include runtime errors, invalid user input, network connectivity issues, and more.

The primary goal of exception handling is to prevent these exceptions from crashing your application.

Exception logging is important for debugging a web application because it provides valuable information about any errors or exceptions that may occur during the execution of the application.

This information can be used by the developer to identify the cause of the error and to determine the appropriate course of action to fix it.

Without exception logging, it can be difficult for a developer to identify and troubleshoot errors in a web application. This is because the application may not provide any clear indication of what went wrong, or the error may only manifest itself in a way that…

--

--

.com software

Father • PHP developer • entrepreneur • working for a €1bn unicorn startup as a backend engineer >>> https://bit.ly/dotcom-software