Skip to content

Commit 112252c

Browse files
cool-RRByron
authored andcommitted
Fix exception causes all over the codebase
1 parent e5410b4 commit 112252c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

gitdb/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ def _init_externals():
1818

1919
try:
2020
__import__(module)
21-
except ImportError:
22-
raise ImportError("'%s' could not be imported, assure it is located in your PYTHONPATH" % module)
21+
except ImportError as e:
22+
raise ImportError("'%s' could not be imported, assure it is located in your PYTHONPATH" % module) from e
2323
# END verify import
2424
# END handel imports
2525

gitdb/db/mem.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ def stream(self, sha):
7474
# rewind stream for the next one to read
7575
ostream.stream.seek(0)
7676
return ostream
77-
except KeyError:
78-
raise BadObject(sha)
77+
except KeyError as e:
78+
raise BadObject(sha) from e
7979
# END exception handling
8080

8181
def size(self):

gitdb/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ def open(self, write=False, stream=False):
326326
else:
327327
self._fd = fd
328328
# END handle file descriptor
329-
except OSError:
330-
raise IOError("Lock at %r could not be obtained" % self._lockfilepath())
329+
except OSError as e:
330+
raise IOError("Lock at %r could not be obtained" % self._lockfilepath()) from e
331331
# END handle lock retrieval
332332

333333
# open actual file if required

0 commit comments

Comments
 (0)