Project

General

Profile

Actions

Task #87852

closed

Pass original DBALException along with SqlErrorException

Added by Christian Futterlieb over 5 years ago. Updated almost 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Database API (Doctrine DBAL)
Target version:
-
Start date:
2019-03-06
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
10
PHP Version:
Tags:
Complexity:
no-brainer
Sprint Focus:

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.

Actions

Also available in: Atom PDF