From 6322feb32dceb7be67b2117686f0a7570a615294 Mon Sep 17 00:00:00 2001 From: jacobg Date: Fri, 4 Apr 2014 10:22:02 -0400 Subject: [PATCH] add a __str__ implementation to APIException Add a __str__ implementation to rest_framework.exceptions.APIException. This helps for logging raised exceptions. Thanks. --- rest_framework/exceptions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rest_framework/exceptions.py b/rest_framework/exceptions.py index 0ac5866ef..5f774a9f3 100644 --- a/rest_framework/exceptions.py +++ b/rest_framework/exceptions.py @@ -20,6 +20,8 @@ class APIException(Exception): def __init__(self, detail=None): self.detail = detail or self.default_detail + def __str__(self): + return self.detail class ParseError(APIException): status_code = status.HTTP_400_BAD_REQUEST