Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exception causes in cmd.py #1022

Merged
merged 1 commit into from
Jun 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions git/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def pump_stream(cmdline, name, stream, is_decode, handler):
handler(line)
except Exception as ex:
log.error("Pumping %r of cmd(%s) failed due to: %r", name, cmdline, ex)
raise CommandError(['<%s-pump>' % name] + cmdline, ex)
raise CommandError(['<%s-pump>' % name] + cmdline, ex) from ex
finally:
stream.close()

Expand Down Expand Up @@ -732,7 +732,7 @@ def execute(self, command,
**subprocess_kwargs
)
except cmd_not_found_exception as err:
raise GitCommandNotFound(command, err)
raise GitCommandNotFound(command, err) from err

if as_process:
return self.AutoInterrupt(proc, command)
Expand Down Expand Up @@ -982,9 +982,9 @@ def _call_process(self, method, *args, **kwargs):
else:
try:
index = ext_args.index(insert_after_this_arg)
except ValueError:
except ValueError as err:
raise ValueError("Couldn't find argument '%s' in args %s to insert cmd options after"
% (insert_after_this_arg, str(ext_args)))
% (insert_after_this_arg, str(ext_args))) from err
# end handle error
args = ext_args[:index + 1] + opt_args + ext_args[index + 1:]
# end handle opts_kwargs
Expand Down