Skip to content

Commit ae077e9

Browse files
committed
Use str to get the exception message
1 parent 2c9e62d commit ae077e9

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

readthedocs/restapi/views/model_views.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
absolute_import, division, print_function, unicode_literals)
66

77
import logging
8+
from builtins import str
89

910
from allauth.socialaccount.models import SocialAccount
1011
from django.shortcuts import get_object_or_404
@@ -173,7 +174,7 @@ def sync_versions(self, request, **kwargs): # noqa: D205
173174
log.exception('Sync Versions Error')
174175
return Response(
175176
{
176-
'error': e.message,
177+
'error': str(e),
177178
},
178179
status=status.HTTP_400_BAD_REQUEST,
179180
)

readthedocs/restapi/views/task_views.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import absolute_import
44
import logging
5+
from builtins import str
56

67
from django.core.urlresolvers import reverse
78
from rest_framework import decorators, permissions
@@ -32,7 +33,7 @@ def get_status_data(task_name, state, data, error=None):
3233
'success': state in SUCCESS_STATES,
3334
}
3435
if error is not None and isinstance(error, Exception):
35-
data['error'] = error.message
36+
data['error'] = str(error)
3637
return data
3738

3839

0 commit comments

Comments
 (0)