mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 04:50:12 +03:00
Update exceptions.py
Call force_text() only if detail is a string, if detail is other data type better leave raw. The idea is give the programmer the possibility to manage other detail data type when catch the exception
This commit is contained in:
parent
df29641f20
commit
bd482284f9
|
@ -39,10 +39,10 @@ class APIException(Exception):
|
|||
default_detail = _('A server error occured')
|
||||
|
||||
def __init__(self, detail=None):
|
||||
if detail is not None:
|
||||
self.detail = force_text(detail)
|
||||
else:
|
||||
if detail is None:
|
||||
self.detail = force_text(self.default_detail)
|
||||
elif isinstance(detail, basestring):
|
||||
self.detail = force_text(detail)
|
||||
|
||||
def __str__(self):
|
||||
return self.detail
|
||||
|
|
Loading…
Reference in New Issue
Block a user