From 8aa91a1466cdb6b70dde99e0df81386374c91625 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Fri, 12 Jun 2020 12:57:54 +0300 Subject: [PATCH] Fix exception causes in cmd.py --- git/cmd.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/git/cmd.py b/git/cmd.py index e87a3b800..acea40c5a 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -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() @@ -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) @@ -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