Skip to content

Commit 536bed6

Browse files
committed
Modify exception_handler for a string error like AuthenticationError
1 parent 403a4b2 commit 536bed6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rest_framework_json_api/exceptions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def exception_handler(exc, context):
2727
field = format_value(field)
2828
pointer = '/data/attributes/{}'.format(field)
2929
# see if they passed a dictionary to ValidationError manually
30-
if isinstance(error, dict):
30+
# or a string in case of AuthenticationError
31+
if isinstance(error, dict) or isinstance(error, str):
3132
errors.append(error)
3233
else:
3334
for message in error:

0 commit comments

Comments
 (0)