If you ever find yourself working with code and an error occurs in Drupal and you get the typical “The website encountered an unexpected error. Please try again later” message, which is an indicator that there is a bug but you have no way of knowing where it was and it is too long to go back and forth trying to find it, Drupal has a manager of error levels to display.
The following tip is a trick that developers can use to see the most obvious mistakes made.
All you have to do is copy the following code.
And paste it into the “settings.php” file of your Drupal installation
The code is placed anywhere in the settings.php file, in this example it was pasted at the end
The changes are saved and we return to the broken page and we can see that the error will now be visible on the page.
Once the code that is causing the error is fixed, we reload the page and it should be fixed.
Very important, perform this action only in local environments since if performed in production it can reveal important information on your server to potential attackers.
Video credits: https://www.youtube.com/watch?v=Mem8nxlBJ0I&ab_channel=OSTraining