Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #20786 -- Cleaned up docs/ref/exceptions.txt

Thanks Daniele Procida for the suggestion and edits.
  • Loading branch information...
commit 920b242e307297778c6e5010f23502c4f41f299c 1 parent fd0d486
Dominic Rodger authored timgraham committed

Showing 1 changed file with 31 additions and 17 deletions. Show diff stats Hide diff stats

  1. 48  docs/ref/exceptions.txt
48  docs/ref/exceptions.txt
@@ -6,24 +6,29 @@ Django Exceptions
6 6
 Django raises some Django specific exceptions as well as many standard
7 7
 Python exceptions.
8 8
 
9  
-Django-specific Exceptions
10  
-==========================
  9
+Django Core Exceptions
  10
+======================
11 11
 
12 12
 .. module:: django.core.exceptions
13  
-    :synopsis: Django specific exceptions
  13
+    :synopsis: Django core exceptions
  14
+
  15
+Django core exception classes are defined in :mod:`django.core.exceptions`.
14 16
 
15 17
 ObjectDoesNotExist and DoesNotExist
16 18
 -----------------------------------
17 19
 .. exception:: DoesNotExist
18  
-.. exception:: ObjectDoesNotExist
19 20
 
20  
-    The :exc:`DoesNotExist` exception is raised when an object is not found
21  
-    for the given parameters of a query.
  21
+    The ``DoesNotExist`` exception is raised when an object is not found for
  22
+    the given parameters of a query. Django provides a ``DoesNotExist``
  23
+    exception as an attribute of each model class to identify the class of
  24
+    object that could not be found and to allow you to catch a particular model
  25
+    class with ``try/except``.
  26
+
  27
+.. exception:: ObjectDoesNotExist
22 28
 
23  
-    :exc:`ObjectDoesNotExist` is defined in :mod:`django.core.exceptions`.
24  
-    :exc:`DoesNotExist` is a subclass of the base :exc:`ObjectDoesNotExist`
25  
-    exception that is provided on every model class as a way of
26  
-    identifying the specific type of object that could not be found.
  29
+    The base class for ``DoesNotExist`` exceptions; a ``try/except`` for
  30
+    ``ObjectDoesNotExist`` will catch ``DoesNotExist`` exceptions for all
  31
+    models.
27 32
 
28 33
     See :meth:`~django.db.models.query.QuerySet.get()` for further information
29 34
     on :exc:`ObjectDoesNotExist` and :exc:`DoesNotExist`.
@@ -121,6 +126,11 @@ ValidationError
121 126
 
122 127
 .. currentmodule:: django.core.urlresolvers
123 128
 
  129
+URL Resolver exceptions
  130
+=======================
  131
+
  132
+URL Resolver exceptions are defined in :mod:`django.core.urlresolvers`.
  133
+
124 134
 NoReverseMatch
125 135
 --------------
126 136
 .. exception:: NoReverseMatch
@@ -134,9 +144,10 @@ NoReverseMatch
134 144
 Database Exceptions
135 145
 ===================
136 146
 
  147
+Database exceptions are provided in :mod:`django.db`.
  148
+
137 149
 Django wraps the standard database exceptions so that your Django code has a
138  
-guaranteed common implementation of these classes. These database exceptions
139  
-are provided in :mod:`django.db`.
  150
+guaranteed common implementation of these classes.
140 151
 
141 152
 .. exception:: Error
142 153
 .. exception:: InterfaceError
@@ -160,34 +171,37 @@ to Python 3.)
160 171
 
161 172
 .. versionchanged:: 1.6
162 173
 
163  
-    Previous version of Django only wrapped ``DatabaseError`` and
  174
+    Previous versions of Django only wrapped ``DatabaseError`` and
164 175
     ``IntegrityError``, and did not provide ``__cause__``.
165 176
 
166 177
 .. exception:: models.ProtectedError
167 178
 
168 179
 Raised to prevent deletion of referenced objects when using
169  
-:attr:`django.db.models.PROTECT`. Subclass of :exc:`IntegrityError`.
  180
+:attr:`django.db.models.PROTECT`. :exc:`models.ProtectedError` is a subclass
  181
+of :exc:`IntegrityError`.
170 182
 
171 183
 .. currentmodule:: django.http
172 184
 
173 185
 Http Exceptions
174 186
 ===============
175 187
 
  188
+Http exceptions are provided in :mod:`django.http`.
  189
+
176 190
 .. exception:: UnreadablePostError
177 191
 
178 192
     The :exc:`UnreadablePostError` is raised when a user cancels an upload.
179  
-    It is available from :mod:`django.http`.
180 193
 
181 194
 .. currentmodule:: django.db.transaction
182 195
 
183 196
 Transaction Exceptions
184 197
 ======================
185 198
 
  199
+Transaction exceptions are defined in :mod:`django.db.transaction`.
  200
+
186 201
 .. exception:: TransactionManagementError
187 202
 
188 203
     The :exc:`TransactionManagementError` is raised for any and all problems
189  
-    related to database transactions. It is available from
190  
-    :mod:`django.db.transaction`.
  204
+    related to database transactions.
191 205
 
192 206
 Python Exceptions
193 207
 =================

0 notes on commit 920b242

Please sign in to comment.
Something went wrong with that request. Please try again.