Skip to content

Commit

Permalink
fix bug and hangle TypeError (#145)
Browse files Browse the repository at this point in the history
Co-authored-by: ayakovlev <ayakovlev@deliveryweb.ru>
  • Loading branch information
sputnik5459 and ayakovlev committed Apr 13, 2021
1 parent a54f42f commit 0547533
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions rest_social_auth/views.py
Expand Up @@ -222,8 +222,12 @@ def respond_error(self, error):
self.log_exception(error)
if hasattr(error, 'response'):
try:
message = error.response.json()['error']['message']
except KeyError:
message = error.response.json()['error']
if isinstance(message, dict) and 'message' in message:
message = message['message']
elif isinstance(message, list) and len(message):
message = message[0]
except (KeyError, TypeError):
pass
else:
logger.error(error)
Expand Down

0 comments on commit 0547533

Please sign in to comment.