Skip to content

Commit

Permalink
Expect error without response + bump version to 5.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
st4lk committed Jan 17, 2021
1 parent ad254aa commit 1f8d0e6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions RELEASE_NOTES.md
@@ -1,6 +1,10 @@
rest_social_auth release notes
==============================

v5.0.1
------
- Expect error without response during error handling

v5.0.0
------
- Update user serializer: exclude field only if it was defined in customer user model
Expand Down
2 changes: 1 addition & 1 deletion rest_social_auth/__init__.py
@@ -1,2 +1,2 @@
__author__ = 'st4lk'
__version__ = '5.0.0'
__version__ = '5.0.1'
9 changes: 5 additions & 4 deletions rest_social_auth/views.py
Expand Up @@ -220,10 +220,11 @@ def respond_error(self, error):
if isinstance(error, Exception):
if not isinstance(error, AuthException) or LOG_AUTH_EXCEPTIONS:
self.log_exception(error)
try:
message = error.response.json()['error']['message']
except KeyError:
pass
if hasattr(error, 'response'):
try:
message = error.response.json()['error']['message']
except KeyError:
pass
else:
logger.error(error)
return Response(data=message, status=status.HTTP_400_BAD_REQUEST)
Expand Down

0 comments on commit 1f8d0e6

Please sign in to comment.