I have built a very small PHP framework as a learning experience, and would like to be able to display the PHP errors in a more readable way, instead of the single line output that is the norm. For example:
Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '5-6' for key 'PRIMARY' in C:\xampp\htdocs\food\app\core\Database.php:74 Stack trace: #0 C:\xampp\htdocs\food\app\core\Database.php(74): PDOStatement->execute() #1 C:\xampp\htdocs\food\app\models\Recipe_model.php(376): Database->execute() #2 C:\xampp\htdocs\food\app\controllers\Recipes.php(206): Recipe_model->edit_recipe_categories(Array) #3 C:\xampp\htdocs\food\app\core\App.php(54): Recipes->edit('5') #4 C:\xampp\htdocs\food\public\index.php(5): App->__construct() #5 {main} thrown in C:\xampp\htdocs\food\app\core\Database.php on line 74"
I’d like to split it into separate lines for each part of the trace back. Is there a simple way of doing this?
I took a look at CodeIgniter’s code because I like the way they display the errors so that they are easy to read, but the code is very long.