Skip to content

Commit 377a018

Browse files
committed
Avoid throwing exceptions with the default exception handler
1 parent 6cfad80 commit 377a018

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

rest_framework_json_api/renderers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def render(self, data, accepted_media_type=None, renderer_context=None):
4747

4848
# If this is an error response, skip the rest.
4949
if resource_name == 'errors':
50-
if len(data) > 1:
50+
if len(data) > 1 and isinstance(data, list):
5151
data.sort(key=lambda x: x.get('source', {}).get('pointer', ''))
5252
return super(JSONRenderer, self).render(
5353
{resource_name: data}, accepted_media_type, renderer_context

0 commit comments

Comments
 (0)