@@ -97,6 +97,8 @@ Note that the exception handler will only be called for responses generated by r
97
97
98
98
## APIException
99
99
100
+ ::: rest_framework.exceptions.APIException
101
+
100
102
** Signature:** ` APIException() `
101
103
102
104
The ** base class** for all exceptions raised inside an ` APIView ` class or ` @api_view ` .
@@ -145,6 +147,8 @@ dictionary of items:
145
147
146
148
## ParseError
147
149
150
+ ::: rest_framework.exceptions.ParseError
151
+
148
152
** Signature:** ` ParseError(detail=None, code=None) `
149
153
150
154
Raised if the request contains malformed data when accessing ` request.data ` .
@@ -153,6 +157,8 @@ By default this exception results in a response with the HTTP status code "400 B
153
157
154
158
## AuthenticationFailed
155
159
160
+ ::: rest_framework.exceptions.AuthenticationFailed
161
+
156
162
** Signature:** ` AuthenticationFailed(detail=None, code=None) `
157
163
158
164
Raised when an incoming request includes incorrect authentication.
@@ -161,6 +167,8 @@ By default this exception results in a response with the HTTP status code "401 U
161
167
162
168
## NotAuthenticated
163
169
170
+ ::: rest_framework.exceptions.NotAuthenticated
171
+
164
172
** Signature:** ` NotAuthenticated(detail=None, code=None) `
165
173
166
174
Raised when an unauthenticated request fails the permission checks.
@@ -169,6 +177,8 @@ By default this exception results in a response with the HTTP status code "401 U
169
177
170
178
## PermissionDenied
171
179
180
+ ::: rest_framework.exceptions.PermissionDenied
181
+
172
182
** Signature:** ` PermissionDenied(detail=None, code=None) `
173
183
174
184
Raised when an authenticated request fails the permission checks.
@@ -177,6 +187,8 @@ By default this exception results in a response with the HTTP status code "403 F
177
187
178
188
## NotFound
179
189
190
+ ::: rest_framework.exceptions.NotFound
191
+
180
192
** Signature:** ` NotFound(detail=None, code=None) `
181
193
182
194
Raised when a resource does not exist at the given URL. This exception is equivalent to the standard ` Http404 ` Django exception.
@@ -185,6 +197,8 @@ By default this exception results in a response with the HTTP status code "404 N
185
197
186
198
## MethodNotAllowed
187
199
200
+ ::: rest_framework.exceptions.MethodNotAllowed
201
+
188
202
** Signature:** ` MethodNotAllowed(method, detail=None, code=None) `
189
203
190
204
Raised when an incoming request occurs that does not map to a handler method on the view.
@@ -193,6 +207,8 @@ By default this exception results in a response with the HTTP status code "405 M
193
207
194
208
## NotAcceptable
195
209
210
+ ::: rest_framework.exceptions.NotAcceptable
211
+
196
212
** Signature:** ` NotAcceptable(detail=None, code=None) `
197
213
198
214
Raised when an incoming request occurs with an ` Accept ` header that cannot be satisfied by any of the available renderers.
@@ -201,6 +217,8 @@ By default this exception results in a response with the HTTP status code "406 N
201
217
202
218
## UnsupportedMediaType
203
219
220
+ ::: rest_framework.exceptions.UnsupportedMediaType
221
+
204
222
** Signature:** ` UnsupportedMediaType(media_type, detail=None, code=None) `
205
223
206
224
Raised if there are no parsers that can handle the content type of the request data when accessing ` request.data ` .
@@ -209,6 +227,8 @@ By default this exception results in a response with the HTTP status code "415 U
209
227
210
228
## Throttled
211
229
230
+ ::: rest_framework.exceptions.Throttled
231
+
212
232
** Signature:** ` Throttled(wait=None, detail=None, code=None) `
213
233
214
234
Raised when an incoming request fails the throttling checks.
@@ -217,6 +237,8 @@ By default this exception results in a response with the HTTP status code "429 T
217
237
218
238
## ValidationError
219
239
240
+ ::: rest_framework.exceptions.ValidationError
241
+
220
242
** Signature:** ` ValidationError(detail=None, code=None) `
221
243
222
244
The ` ValidationError ` exception is slightly different from the other ` APIException ` classes:
@@ -243,6 +265,8 @@ API-only application.)
243
265
244
266
Use these as per [ Django's Customizing error views documentation] [ django-custom-error-views ] .
245
267
268
+ ::: rest_framework.exceptions.server_error
269
+
246
270
## ` rest_framework.exceptions.server_error `
247
271
248
272
Returns a response with status code ` 500 ` and ` application/json ` content type.
@@ -251,6 +275,8 @@ Set as `handler500`:
251
275
252
276
handler500 = 'rest_framework.exceptions.server_error'
253
277
278
+ ::: rest_framework.exceptions.bad_request
279
+
254
280
## ` rest_framework.exceptions.bad_request `
255
281
256
282
Returns a response with status code ` 400 ` and ` application/json ` content type.
0 commit comments