Skip to content

Commit

Permalink
Use str to get the exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
stsewd committed Apr 5, 2018
1 parent d557fee commit 0761a06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions readthedocs/restapi/views/model_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
absolute_import, division, print_function, unicode_literals)

import logging
from builtins import str

from allauth.socialaccount.models import SocialAccount
from django.shortcuts import get_object_or_404
Expand Down Expand Up @@ -170,10 +171,10 @@ def sync_versions(self, request, **kwargs): # noqa: D205
added_versions.update(ret_set)
deleted_versions = api_utils.delete_versions(project, data)
except Exception as e:
log.exception('Sync Versions Error: %s', e.message)
log.exception('Sync Versions Error: %s', str(e))
return Response(
{
'error': e.message,
'error': str(e),
},
status=status.HTTP_400_BAD_REQUEST,
)
Expand Down
3 changes: 2 additions & 1 deletion readthedocs/restapi/views/task_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from __future__ import absolute_import
import logging
from builtins import str

from django.core.urlresolvers import reverse
from rest_framework import decorators, permissions
Expand Down Expand Up @@ -32,7 +33,7 @@ def get_status_data(task_name, state, data, error=None):
'success': state in SUCCESS_STATES,
}
if error is not None and isinstance(error, Exception):
data['error'] = error.message
data['error'] = str(error)
return data


Expand Down

0 comments on commit 0761a06

Please sign in to comment.