Issue Task Closed

#87852Pass original DBALException along with SqlErrorException

Christian Futterlieb 03/06/19, 19:08 updated 12/23/19, 22:48

Description

When a TYPO3\CMS\Extbase\Persistence\Generic\Storage\Exception\SqlErrorException is thrown, register the previous exception as 3rd parameter to the exception’s constructor:

try {
    $this->connectionPool->getConnectionForTable($tableName)->update($tableName, $fieldValues, $where);
} catch (DBALException $e) {
    throw new SqlErrorException($e->getPrevious()->getMessage(), 1470230768, $e);
}

Like this, it is possible to determine, what exactly went wrong and then for example re-try, log or do something else. I’ll submit that tiny patch in a minute.

Note: I set TYPO3 version to ‘10’, but I’d like to add this to 9.5 and 8.7 too.

Reviews 3