1
0
mirror of https://github.com/instaloader/instaloader.git synced 2024-08-18 20:59:38 +02:00

always keep exception chains

This commit is contained in:
Alexander Graf 2021-03-20 17:17:08 +01:00
parent f70355e803
commit 08eaa7d474
2 changed files with 5 additions and 3 deletions

View File

@ -459,7 +459,7 @@ def main():
storyitem_filter_str=args.storyitem_filter)
loader.close()
except InstaloaderException as err:
raise SystemExit("Fatal error: %s" % err)
raise SystemExit("Fatal error: %s" % err) from err
if __name__ == "__main__":

View File

@ -222,8 +222,10 @@ class InstaloaderContext:
data={'enc_password': enc_password, 'username': user}, allow_redirects=True)
try:
resp_json = login.json()
except json.decoder.JSONDecodeError:
raise ConnectionException("Login error: JSON decode fail, {} - {}.".format(login.status_code, login.reason))
except json.decoder.JSONDecodeError as err:
raise ConnectionException(
"Login error: JSON decode fail, {} - {}.".format(login.status_code, login.reason)
) from err
if resp_json.get('two_factor_required'):
two_factor_session = copy_session(session, self.request_timeout)
two_factor_session.headers.update({'X-CSRFToken': csrf_token})