FIX Only continue delegation when DB exceptions are caused by no database selected

This prevents the middleware from interrupting legitimate database exceptions from being
propagated.
This commit is contained in:
Robbie Averill 2018-09-07 11:03:51 +02:00
parent 70dc70f494
commit 313d22ffca

View File

@ -43,8 +43,12 @@ class InitStateMiddleware implements HTTPMiddleware
return $delegate($request);
} catch (DatabaseException $ex) {
// Database is not ready
$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()) {