Skip to content

Commit 4720e63

Browse files
cool-RRByron
authored andcommitted
Fix exception causes in cmd.py
1 parent 24cd6da commit 4720e63

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

git/cmd.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def pump_stream(cmdline, name, stream, is_decode, handler):
8383
handler(line)
8484
except Exception as ex:
8585
log.error("Pumping %r of cmd(%s) failed due to: %r", name, cmdline, ex)
86-
raise CommandError(['<%s-pump>' % name] + cmdline, ex)
86+
raise CommandError(['<%s-pump>' % name] + cmdline, ex) from ex
8787
finally:
8888
stream.close()
8989

@@ -732,7 +732,7 @@ def execute(self, command,
732732
**subprocess_kwargs
733733
)
734734
except cmd_not_found_exception as err:
735-
raise GitCommandNotFound(command, err)
735+
raise GitCommandNotFound(command, err) from err
736736

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

0 commit comments

Comments
 (0)