Skip to content

Commit 0336879

Browse files
committed
Merge pull request ozgur#69 from devinbarry/develop
Correctly fetch the message detail from the response.
2 parents bb5b91e + 00dec66 commit 0336879

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

linkedin/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ def to_utf8(st):
5050
def raise_for_error(response):
5151
try:
5252
response.raise_for_status()
53-
except (requests.HTTPError, requests.ConnectionError), error:
53+
except (requests.HTTPError, requests.ConnectionError) as error:
5454
try:
5555
if len(response.content) == 0:
5656
# There is nothing we can do here since LinkedIn has neither sent
5757
# us a 2xx response nor a response content.
5858
return
5959
response = response.json()
6060
if ('error' in response) or ('errorCode' in response):
61-
message = '%s: %s' % (response.get('error', error.message),
62-
response.get('error_description', 'Unknown Error'))
61+
message = '%s: %s' % (response.get('error', str(error)),
62+
response.get('message', 'Unknown Error'))
6363
error_code = response.get('status')
6464
ex = get_exception_for_error_code(error_code)
6565
raise ex(message)

0 commit comments

Comments
 (0)