#6842 closed (fixed)
Documentation: Document Django exceptions
Reported by: | Owned by: | John Shimek | |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Keywords: | model | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Using Django, many people are going to be writing web applications ( like salesforce.com for example) as opposed to mainly content/publishing sites ( example wapo and curse) and they will need to know the list of exceptions.
Please document exceptions django throws. Specially those thrown/raised by model methods.
I want to catch those exceptions and display appropriate custom message to my users (not the default 404).
From: Malcolm Tredinnick <malc...@…>
Date: Fri, 21 Mar 2008 05:44:56 +1100
Local: Thurs, Mar 20 2008 11:44 am
Subject: Re: Django Exception handling
Reply | Reply to author | Forward | Print | Individual message | Show original | Report this message | Find messages by this author
There's a list of most of Django's exceptions in
django/core/exceptions.py. In addition to that, you can get database
exceptions (DatabaseErrror and IntegrityError are two we push into the
Django namespace, but all errors from the DB API are possible), plus a
few internal Python exception types. Search for 'raise' in
django/db/models/base.py, for example. In fact, search for 'raise' in
django/db/models/ and subdirectories to see the full set of
possibilities there.
Regards,
Malcolm
Attachments (3)
Change History (15)
comment:1 by , 17 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 16 years ago
Attachment: | r8472.diff added |
---|
comment:3 by , 16 years ago
Has patch: | set |
---|---|
Owner: | changed from | to
Patch needs improvement: | set |
I have started a doc for this since I needed info on the exceptions. I haven' finished it, far from it, but I would like someone to take a look at it and see if I am heading in the right direction.
by , 16 years ago
Attachment: | r8643.diff added |
---|
comment:4 by , 16 years ago
I have a fairly complete patch I think. I am sure there is still work to be done. I don't really know all the use cases of each exception, but I did my best.
One thing that needs to be fixed is I was linking to the the get() method in the db-api docs, but I think i had that link wrong, and then the docs refactor landed and it is now definitely wrong.
Also, I don't really know what a suspicious operation is or what "middleware not used" means. I just rewrote what was in exceptions.py.
I know this is far from perfect but if I waited til it was perfect before submitting, I would never submit it:)
comment:5 by , 15 years ago
I think the development debug error pages are also a really great source of documentation and it would be incredibly useful to Django noobs like me if these could just show which module an exception was defined in (and not just which file raised it).
follow-up: 9 comment:7 by , 15 years ago
Not sure why this patch is touching the Queryset.get bits, that feels like it should be a different ticket. It applies cleanly to trunk, and feels like useful information to include. I know that a lot of people I've talked to didn't know about raising ImproperlyConfigured and the like.
The docs should probably also mention that these exceptions can be raised by user code, and not just Django, and the appropriate situations there (though it should match/jive with how Django uses them).
comment:8 by , 15 years ago
Some of these exceptions, MiddleWareNotInUse is only ever raised from usre code.
comment:9 by , 15 years ago
Replying to ericholscher:
Not sure why this patch is touching the Queryset.get bits, that feels like it should be a different ticket.
It is adding meta data mark up so cross-linking from inside the exception description paragraphs is saner. Anyway that is being attacked in a more complete way in #12997
comment:10 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I have a better plan. Since you need this information and are about to pull it out for your own use, write it up as you go and submit a docs patch. That way everybody will benefit from your work.