Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#22321 closed Bug (fixed)

Missing DB errors wrapping around _set_autocommit

Reported by: Alexander Koshelev Owned by: Aymeric Augustin
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

Implementation defined _set_autocommit function can raise DatabaseError that will not be wrapped and converted to unified exception class by caller in BaseDatabaseWrapper.set_autocommit.

Change History (9)

comment:2 by Alexander Koshelev, 10 years ago

Summary: Missing DB errors wraping around _set_autocommitMissing DB errors wrapping around _set_autocommit

comment:3 by Aymeric Augustin, 10 years ago

Has patch: set
Owner: changed from nobody to Aymeric Augustin
Status: newassigned
Triage Stage: UnreviewedAccepted
Type: UncategorizedBug

It turns out that I was working in this area today. See https://github.com/django/django/pull/2468.

comment:4 by Alexander Koshelev, 10 years ago

Looks good but I don't understand why we cannot wrap exceptions in the one place – BaseDatabaseWrapper.set_autocommit?

Last edited 10 years ago by Alexander Koshelev (previous) (diff)

comment:5 by Aymeric Augustin, 10 years ago

For consistency. If you look at the rest of the class, database-level methods are prefixed with an underscore and that's where this handling belongs.

If a database adapter implementation autocommit in such a way that _set_autocommit couldn't raise an exception, it wouldn't need the exception wrapping (but that's a rather theoretical argument).

comment:6 by Alexander Koshelev, 10 years ago

Oh, ok. It is not so obvious at first glance.

comment:7 by Aymeric Augustin <aymeric.augustin@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In 3becac84845cee8f12a5fb7f68c87cbaf029c6a0:

Fixed #22321 -- Wrapped exceptions in _set_autocommit.

Refs #21202.

comment:8 by Aymeric Augustin <aymeric.augustin@…>, 10 years ago

In 746cded010c7ba3e2bf2df4cde32dcc9b75cb0d3:

[1.6.x] Fixed #22321 -- Wrapped exceptions in _set_autocommit.

Refs #21202.

Backport of 3becac84 from master

comment:9 by Aymeric Augustin <aymeric.augustin@…>, 10 years ago

In 5f22bda3827f32289793b90a387d8c77d602a859:

[1.7.x] Fixed #22321 -- Wrapped exceptions in _set_autocommit.

Refs #21202.

Backport of 3becac84 from master

Note: See TracTickets for help on using tickets.
Back to Top