Merge pull request #389 from creative-commoners/pulls/2.1/dont-catch-exceptions

FIX Only continue delegation when DB exceptions are caused by no database selected
This commit is contained in:
Dylan Wagstaff 2018-09-08 18:54:51 +12:00 committed by GitHub
commit fa3f1fa767
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -43,8 +43,12 @@ class InitStateMiddleware implements HTTPMiddleware
return $delegate($request);
} catch (DatabaseException $ex) {
// Database is not ready
return $delegate($request);
$message = $ex->getMessage();
if (strpos($message, 'No database selected') !== false) {
// Database is not ready, ignore and continue
return $delegate($request);
}
throw $ex;
} finally {
// Persist to the session if using the CMS
if ($state->getUseSessions()) {