From ed93e13a1c6f792e14176bdaa5e96d0fa2c63a2f Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Mon, 1 Dec 2014 12:20:07 +0000 Subject: Update documentation --- api-guide/exceptions/index.html | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'api-guide/exceptions/index.html') diff --git a/api-guide/exceptions/index.html b/api-guide/exceptions/index.html index 30939688..70c51cac 100644 --- a/api-guide/exceptions/index.html +++ b/api-guide/exceptions/index.html @@ -164,6 +164,10 @@ Serializer relations +
Signature: ParseError(detail=None)
Raised if the request contains malformed data when accessing request.DATA or request.FILES.
Raised if the request contains malformed data when accessing request.data.
By default this exception results in a response with the HTTP status code "400 Bad Request".
Signature: AuthenticationFailed(detail=None)
By default this exception results in a response with the HTTP status code "405 Method Not Allowed".
Signature: UnsupportedMediaType(media_type, detail=None)
Raised if there are no parsers that can handle the content type of the request data when accessing request.DATA or request.FILES.
Raised if there are no parsers that can handle the content type of the request data when accessing request.data.
By default this exception results in a response with the HTTP status code "415 Unsupported Media Type".
Signature: Throttled(wait=None, detail=None)
Raised when an incoming request fails the throttling checks.
By default this exception results in a response with the HTTP status code "429 Too Many Requests".
+Signature: ValidationError(detail)
The ValidationError exception is slightly different from the other APIException classes:
detail argument is mandatory, not optional.detail argument may be a list or dictionary of error details, and may also be a nested data structure.ValidationError style, in order to differentiate it from Django's built-in validation error. For example. raise serializers.ValidationError('This field must be an integer value.')The ValidationError class should be used for serializer and field validation, and by validator classes. It is also raised when calling serializer.is_valid with the raise_exception keyword argument:
serializer.is_valid(raise_exception=True)
+
+The generic views use the raise_exception=True flag, which means that you can override the style of validation error responses globally in your API. To do so, use a custom exception handler, as described above.
By default this exception results in a response with the HTTP status code "400 Bad Request".
@@ -524,7 +549,7 @@ class ServiceUnavailable(APIException): -- cgit v1.2.3