diff options
| author | Xavier Ordoquy | 2014-02-18 11:42:35 +0100 |
|---|---|---|
| committer | Xavier Ordoquy | 2014-02-18 11:42:35 +0100 |
| commit | b2f0f4fcf49d457aefc21960f62fcb8f2cf6770d (patch) | |
| tree | 9adabfaa8c2a73e9b1304f8d699a3f70f284634a /docs/api-guide/exceptions.md | |
| parent | 5ae94547bc08ade94c3f1df2223c0b8261cae59f (diff) | |
| parent | 822eb39599b248c68573c3095639a831ab6df99a (diff) | |
| download | django-rest-framework-b2f0f4fcf49d457aefc21960f62fcb8f2cf6770d.tar.bz2 | |
Merge remote-tracking branch 'reference/master' into feature/django_1_7
Diffstat (limited to 'docs/api-guide/exceptions.md')
| -rw-r--r-- | docs/api-guide/exceptions.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/api-guide/exceptions.md b/docs/api-guide/exceptions.md index 221df679..66e18173 100644 --- a/docs/api-guide/exceptions.md +++ b/docs/api-guide/exceptions.md @@ -18,7 +18,7 @@ The handled exceptions are: In each case, REST framework will return a response with an appropriate status code and content-type. The body of the response will include any additional details regarding the nature of the error. -By default all error responses will include a key `details` in the body of the response, but other keys may also be included. +By default all error responses will include a key `detail` in the body of the response, but other keys may also be included. For example, the following request: @@ -86,7 +86,7 @@ Note that the exception handler will only be called for responses generated by r The **base class** for all exceptions raised inside REST framework. -To provide a custom exception, subclass `APIException` and set the `.status_code` and `.detail` properties on the class. +To provide a custom exception, subclass `APIException` and set the `.status_code` and `.default_detail` properties on the class. For example, if your API relies on a third party service that may sometimes be unreachable, you might want to implement an exception for the "503 Service Unavailable" HTTP response code. You could do this like so: @@ -94,7 +94,7 @@ For example, if your API relies on a third party service that may sometimes be u class ServiceUnavailable(APIException): status_code = 503 - detail = 'Service temporarily unavailable, try again later.' + default_detail = 'Service temporarily unavailable, try again later.' ## ParseError |
