If Drupal is unable to connect to a database server as defined in settings.php, it will throw an exception like the following:
Unable to reach DB host
PDOException: SQLSTATE[HY000] [2002] No such file or directory in /core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php on line 83
Access denied
PDOException: SQLSTATE[HY000] [1044] Access denied for user ''@'localhost' to database 'drupal' in /core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php on line 83
It would be great to have friendlier error messages displayed to the user.