Review main Merged

87711[BUGFIX] Avoid $e->getPrevious() in DH->insertDB() exceptions

Christian Kuhn CR +2 V +2 Normal +60 −67 updated 01/14/25, 17:39

Commit message

$e->getPrevious() on \Doctrine\DBAL\Exception may be null
depending on the specific doctrine exception being thrown.
Within DataHandler->insertDB(), we're interested in the fail
message from the driver if given. The exception handling
within doctrine has been improved with v3. The exception
message of \Doctrine\DBAL\Exception now always contains
the fail message from a driver if given, there is no
point in trying to fetch the message from a possible
previous exception anymore.
The patch streamlines DataHandler->insertDB() a bit and
logs the exception message from the "outer" exception
directly.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Benni Mack +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Stefan Bürk +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 3

Files 1

Review log 2936

Show 811 earlier messages
  1. Christian Kuhn uploaded patch set 1 01/13/25, 11:59

  2. Christian Kuhn commented on patch set 1 01/13/25, 12:00

    DataHandler.php:7741

    ?-> is the key here.
  3. Christian Kuhn commented on patch set 1 01/13/25, 12:06

    DataHandler.php:7742

    i'm aware this log row may end up with 'SQL error: "" ...' but would tend to keep it like this for now.
  4. core-ci voted on patch set 1 V +1 01/13/25, 12:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72328

  5. Benni Mack voted on patch set 1 CR +1 V +1 01/13/25, 12:17

  6. Benjamin Franzke commented on patch set 1 01/13/25, 12:22

  7. Christian Kuhn uploaded patch set 2 CR +1 V +1 01/13/25, 12:33

  8. Christian Kuhn updated the commit message in patch set 3 01/13/25, 12:34

  9. Christian Kuhn commented on patch set 3 01/13/25, 12:39

    Reply

    yeah. this may happen in further places. i suggest to use this patch to decide on how to fix these cases, bring it in for this single case, and then take care of https://review.typo3.org/c/Packages/TYPO3.CMS/+/86958 for other cases. this way, we get this specific one fixed quickly and have a strategy for the others as well.
  10. core-ci voted on patch set 2 V +1 01/13/25, 12:40 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72330

  11. core-ci voted on patch set 3 V +1 01/13/25, 12:42 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72331

  1. Benni Mack commented on patch set 3 01/13/25, 13:15

    Reply

    good point, I added a main issue here to not loose this information https://forge.typo3.org/issues/105919
  2. Benni Mack updated the commit message in patch set 4 V +1 01/13/25, 13:15

  3. Benni Mack voted on patch set 4 CR +1 V +1 01/13/25, 13:15

  4. core-ci voted on patch set 4 V +1 01/13/25, 13:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72339

  5. Oli Bartsch voted on patch set 4 CR +1 V +1 01/13/25, 13:28

  6. Sybille Peters commented on patch set 4 V +1 01/13/25, 13:40

    There are some more $e->getPrevious()->getMessage() in the DH. Should they be handled as well? I tested with my use case and this is now fixed.
  7. Garvin Hicking commented on patch set 4 CR +1 V +1 01/13/25, 13:47

  8. Sybille Peters voted on patch set 4 CR +1 01/13/25, 14:38

  9. Benjamin Franzke commented on patch set 4 01/13/25, 15:00

    Reply

    I suggest to discuss this in https://review.typo3.org/c/Packages/TYPO3.CMS/+/86958/1#message-c15d4f7207184ca5799c90ec5355ce66ab2a7f4a where the discussion about this topic started. CC @stefan@buerk.tech who already commented there
  10. Christian Kuhn uploaded patch set 5 CR +1 V +1 01/13/25, 15:58

  11. core-ci voted on patch set 5 V +1 01/13/25, 16:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72364

  12. Stefan Bürk commented on patch set 5 CR +1 V +1 01/13/25, 16:07

    Reply

    Talked with lolli. It does not make sense to use the previous exception in these cases. The outer exception message should be used which makes this more reliable, which lolli changed already. Let's take this change as a first dedicated isolated change and do it as a practical bugfix. The aforementioned other change can be used to align it with this solution either for the single case or as a more cross-over to fix it. Going to take care of it.
  13. Sybille Peters voted on patch set 5 CR +1 V +1 01/14/25, 07:07

  14. Christian Kuhn commented on patch set 5 01/14/25, 11:54

    DataHandler.php:7740

    $e->getPrevious() is a remnant from doctrine/dbal v2 where driver exceptions where 'wrapped' in DBALException. This has been removed in doctrine/dbal v3 with a series of patches. -> we don't need getPrevious() anymore. -> i'll merge this change now, and we can continue with other places in https://review.typo3.org/c/Packages/TYPO3.CMS/+/86958/
  15. Christian Kuhn uploaded patch set 6 CR +1 V +1 01/14/25, 12:06

  16. Stefan Bürk voted on patch set 6 CR +1 V +1 01/14/25, 12:07

  17. Christian Kuhn voted on patch set 6 CR -1 01/14/25, 12:12

  18. core-ci voted on patch set 6 V +1 01/14/25, 12:13 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72458

  19. Christian Kuhn commented on patch set 6 01/14/25, 12:18

    mmh, still not satisfied at least with commit message.
  20. Christian Kuhn updated the commit message in patch set 7 CR +1 V +1 01/14/25, 12:54

  21. core-ci voted on patch set 7 V +1 01/14/25, 13:01 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/72460

  22. Stefan Bürk voted on patch set 7 CR +1 V +1 01/14/25, 13:16

  23. Benni Mack voted on patch set 7 CR +1 V +1 01/14/25, 16:17

  24. Christian Kuhn voted on patch set 7 CR +2 V +2 01/14/25, 16:41

  25. Christian Kuhn merged patch set 8 01/14/25, 17:39