Skip to content

[FEATURE REQUEST] Database errors should be translated from generic errors to PEP249-compliant errors #289

Open

Description

Is your feature request related to a problem? If so, please give a short summary of the problem and how the feature would resolve it
With the exception of back-off errors that are handled, database errors get raised as "raw" Error objects, making catching them properly more challenging.

Describe the preferred solution
Database errors should be caught, their codes parsed, and re-raised as one of the PEP-249 error types.

Reference Documentations/Specifications
https://docs.djangoproject.com/en/4.2/ref/exceptions/#database-exceptions
https://peps.python.org/pep-0249/

Looks like the correct spot to fix this would go quite naturally in this function:

def _on_error(self, e):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions