Drupal 8 and drupal 9 is not something we used to, like drupal 7, its is entirely disffrent code base and templating engine. for this new dcenario we need to be able to keep our dubugging skills upto date as the new drupal 8 and 9 thorwing errors on us and if we are able to fix it, chances are, we are going to install fresh copy of drupal each time, thiis is what I have heard from some developers and alos eaperinced in early version of drupal 8.
This is somthing you will see if each time if having any error in yu code.
1) Goto sites/ and copy example.settings.local.php
Paste in > sites/default and rename it to settings.local.php
2) goto the settings.local.php file and uncomment the following line if commented.
$config['system.logging']['error_level'] = 'verbose';
3) goto edit settings.php in same sites/default directory and uncommnet the following line:
if (file_exists($app_root . '/' . $site_path . '/settings.local.php')) {
include $app_root . '/' . $site_path . '/settings.local.php';
}
Additionally add following line in settings.local.php
error_reporting(E_ALL); ini_set('display_errors', TRUE); ini_set('display_startup_errors', TRUE);
Above solution will produce all errors on your screen that help you to fix the error.