[TASK] DatabaseSessionBackend: Pass on DB exception information 57/51657/2
authorMarkus Klein <markus.klein@typo3.org>
Mon, 13 Feb 2017 15:20:19 +0000 (16:20 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Mon, 13 Feb 2017 15:25:55 +0000 (16:25 +0100)
We add the original message from the DBAL exception to our custom
message in the session backend exception.

Resolves: #79781
Releases: master
Change-Id: I8aec6ba5dcee097f65d4f06916e158092fa31f04
Reviewed-on: https://review.typo3.org/51657
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/core/Classes/Session/Backend/DatabaseSessionBackend.php

index d293cad..2827caa 100644 (file)
@@ -136,7 +136,11 @@ class DatabaseSessionBackend implements SessionBackendInterface
                 ['ses_data' => \PDO::PARAM_LOB]
             );
         } catch (DBALException $e) {
-            throw new SessionNotCreatedException('Session could not be written to database', 1481895005, $e);
+            throw new SessionNotCreatedException(
+                'Session could not be written to database Reason: ' . $e->getMessage(),
+                1481895005,
+                $e
+            );
         }
 
         return $sessionData;
@@ -167,7 +171,7 @@ class DatabaseSessionBackend implements SessionBackendInterface
             );
         } catch (DBALException $e) {
             throw new SessionNotUpdatedException(
-                'Session with id ' . $sessionId . ' could not be updated',
+                'Session with id ' . $sessionId . ' could not be updated. Reason: ' . $e->getMessage(),
                 1481889220,
                 $e
             );