Skip to content

Commit

Permalink
Put more information into error message for login failures (#66)
Browse files Browse the repository at this point in the history
* Put more information into error message for login failures

* Make new error handling code safer

* Disable pylint rules to explicit no-member check
  • Loading branch information
dmosorast authored Aug 22, 2019
1 parent 1711c40 commit 5d113e4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tap_salesforce/salesforce/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,10 @@ def login(self):
self.instance_url = auth['instance_url']
except Exception as e:
error_message = str(e)
if resp:
if resp is None and hasattr(e, 'response') and e.response is not None: #pylint:disable=no-member
resp = e.response #pylint:disable=no-member
# NB: requests.models.Response is always falsy here. It is false if status code >= 400
if isinstance(resp, requests.models.Response):
error_message = error_message + ", Response from Salesforce: {}".format(resp.text)
raise Exception(error_message) from e
finally:
Expand Down

0 comments on commit 5d113e4

Please sign in to comment.