summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRam Rachum <ram@rachum.com>2020-06-14 14:35:48 +0300
committerSebastian Thiel <sebastian.thiel@icloud.com>2020-06-15 11:09:23 +0800
commit112252cef0d418fd070671e64b18558c2f2cf2f1 (patch)
treede2824755c05d2a92a0c5a710c19c97027a068d1
parente5410b4166d177f90901db4986753787d34bc48f (diff)
downloadgitdb-112252cef0d418fd070671e64b18558c2f2cf2f1.tar.gz
Fix exception causes all over the codebase
-rw-r--r--gitdb/__init__.py4
-rw-r--r--gitdb/db/mem.py4
-rw-r--r--gitdb/util.py4
3 files changed, 6 insertions, 6 deletions
diff --git a/gitdb/__init__.py b/gitdb/__init__.py
index 5f56773..31e4d45 100644
--- a/gitdb/__init__.py
+++ b/gitdb/__init__.py
@@ -18,8 +18,8 @@ def _init_externals():
try:
__import__(module)
- except ImportError:
- raise ImportError("'%s' could not be imported, assure it is located in your PYTHONPATH" % module)
+ except ImportError as e:
+ raise ImportError("'%s' could not be imported, assure it is located in your PYTHONPATH" % module) from e
# END verify import
# END handel imports
diff --git a/gitdb/db/mem.py b/gitdb/db/mem.py
index 8711334..5b242e4 100644
--- a/gitdb/db/mem.py
+++ b/gitdb/db/mem.py
@@ -74,8 +74,8 @@ class MemoryDB(ObjectDBR, ObjectDBW):
# rewind stream for the next one to read
ostream.stream.seek(0)
return ostream
- except KeyError:
- raise BadObject(sha)
+ except KeyError as e:
+ raise BadObject(sha) from e
# END exception handling
def size(self):
diff --git a/gitdb/util.py b/gitdb/util.py
index d680f97..c4cafec 100644
--- a/gitdb/util.py
+++ b/gitdb/util.py
@@ -326,8 +326,8 @@ class LockedFD(object):
else:
self._fd = fd
# END handle file descriptor
- except OSError:
- raise IOError("Lock at %r could not be obtained" % self._lockfilepath())
+ except OSError as e:
+ raise IOError("Lock at %r could not be obtained" % self._lockfilepath()) from e
# END handle lock retrieval
# open actual file if required