summaryrefslogtreecommitdiff
path: root/git/index
diff options
context:
space:
mode:
authorRam Rachum <ram@rachum.com>2020-06-13 23:29:59 +0300
committerSebastian Thiel <sebastian.thiel@icloud.com>2020-06-14 08:30:09 +0800
commit411635f78229cdec26167652d44434bf8aa309ab (patch)
tree1e301ce6bdd458d4db20c993695bb763d1b9d158 /git/index
parent99ba753b837faab0509728ee455507f1a682b471 (diff)
downloadgitpython-411635f78229cdec26167652d44434bf8aa309ab.tar.gz
Fix exception causes all over the codebase
Diffstat (limited to 'git/index')
-rw-r--r--git/index/base.py6
-rw-r--r--git/index/fun.py2
2 files changed, 4 insertions, 4 deletions
diff --git a/git/index/base.py b/git/index/base.py
index 46974239..02299275 100644
--- a/git/index/base.py
+++ b/git/index/base.py
@@ -420,9 +420,9 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
rval = None
try:
proc.stdin.write(("%s\n" % filepath).encode(defenc))
- except IOError:
+ except IOError as e:
# pipe broke, usually because some error happened
- raise fmakeexc()
+ raise fmakeexc() from e
# END write exception handling
proc.stdin.flush()
if read_from_stdout:
@@ -954,7 +954,7 @@ class IndexFile(LazyMixin, diff.Diffable, Serializable):
if not skip_hooks:
run_commit_hook('post-commit', self)
return rval
-
+
def _write_commit_editmsg(self, message):
with open(self._commit_editmsg_filepath(), "wb") as commit_editmsg_file:
commit_editmsg_file.write(message.encode(defenc))
diff --git a/git/index/fun.py b/git/index/fun.py
index c6337909..e92e8e38 100644
--- a/git/index/fun.py
+++ b/git/index/fun.py
@@ -82,7 +82,7 @@ def run_commit_hook(name, index, *args):
close_fds=is_posix,
creationflags=PROC_CREATIONFLAGS,)
except Exception as ex:
- raise HookExecutionError(hp, ex)
+ raise HookExecutionError(hp, ex) from ex
else:
stdout = []
stderr = []