Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not handle 500 errors and messages #15

Open
idiotricks opened this issue Mar 27, 2020 · 0 comments
Open

Does not handle 500 errors and messages #15

idiotricks opened this issue Mar 27, 2020 · 0 comments
Assignees

Comments

@idiotricks
Copy link

idiotricks commented Mar 27, 2020

When I add protect to on_delete in one of the FK fields, for example:

class StockIn(Timestamp):
   ....
    supplier = models.ForeignKey(
        Supplier,
        on_delete=models.PROTECT,
        related_name='supplierstockin',
        blank=True,
        null=True
    )

and when I try to delete a supplier, an error 500 occurs. However, the messages are very common such as:

Request failed with status code 500

In fact, I see the error message is (in the form of html not json):

Cannot delete some instances of the 'Supplier' model because they are referenced through a protected foreign key: 'StockIn.supplier'

Can this issue make the message like:

{
     "type": "BlaBlaError",
     "details": {...},
     "fallback_message": "Cannot delete some instances of the 'Supplier' model because they are referenced through a protected foreign key: 'StockIn.supplier'."
}

If it can, this will greatly help us in developing applications quickly and correctly displaying errors to users. Thank you...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants