Mitja Nikolaus | e920808 | 2018-07-30 14:22:09 +0200 | [diff] [blame^] | 1 | """Response descriptions for HTTP responses.""" |
| 2 | |
| 3 | |
| 4 | def default_desc(exception): |
| 5 | """Get the default response description for an exception. |
| 6 | |
| 7 | Args: |
| 8 | exception (rest_framework.exceptions.APIException): |
| 9 | A subclass of APIException for which the response description |
| 10 | should be returned. |
| 11 | |
| 12 | Returns: |
| 13 | (int, str): |
| 14 | A tuple containing the matching status code and default description |
| 15 | for the exception. |
| 16 | |
| 17 | """ |
| 18 | return exception.status_code, str(exception.default_detail) |