Database errors get mangled
|Reported by:||gcbirzan@…||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||master|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
When using the Django wrapper around the database connection, all errors are mangled into two exceptions, DatabaseError and IntegrityError. The only trace of the original exception is in the message, which can be localised, and is not always reliable anyway.
This seems to be a design decision as instead of raising the correct exception, a DatabaseError is constructed with the same message: https://code.djangoproject.com/browser/django/trunk/django/db/backends/postgresql_psycopg2/base.py#L56
This makes it non-trivial (bordering on impossible) to do some database stuff through the default django db backends.
Change History (2)
comment:1 Changed 3 years ago by akaariai
- Needs documentation unset
- Needs tests unset
- Patch needs improvement unset
- Triage Stage changed from Unreviewed to Accepted
- Type changed from Bug to New feature