DatabaseExceptionWrapper has incorrect arguments in Insert

Created on 21 April 2021, almost 4 years ago
Updated 11 April 2023, about 2 years ago

Problem/Motivation

#3137883: Deprecate passing a StatementInterface object to Connection::query β†’ added a DatabaseExceptionWrapper. The third argument should be the \Throwable and not the code.

throw new DatabaseExceptionWrapper($message, 0, $e->getCode());

Steps to reproduce

  • Write some code that does a bad insert. The expected exception is not a DatabaseExceptionWrapper.

Proposed resolution

Change to throw new DatabaseExceptionWrapper($message, $e->getCode(), $e);

Remaining tasks

1. Write a test in the database group to assert that bad queries have the correct exception thrown. To start with, let's focus on queries that get caught in DatabaseExceptionWrapper exceptions and not in the other exceptions. This could have a data provider to assert a query on a specific database driver.
2. Make the fix.
3. Review

User interface changes

No

API changes

No

Data model changes

No

Release notes snippet

πŸ› Bug report
Status

Closed: outdated

Version

10.1 ✨

Component
PostgreSQL driverΒ  β†’

Last updated 11 days ago

No maintainer
Created by

πŸ‡ΊπŸ‡ΈUnited States mradcliffe USA

Live updates comments and jobs are added and updated live.
  • PostgreSQL

    Particularly affects sites running on the PostgreSQL database.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024