From e5410b4166d177f90901db4986753787d34bc48f Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Fri, 12 Jun 2020 13:52:38 +0300 Subject: Fix exception causes in loose.py --- gitdb/db/loose.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gitdb/db/loose.py b/gitdb/db/loose.py index 7bf92da..a63a2ef 100644 --- a/gitdb/db/loose.py +++ b/gitdb/db/loose.py @@ -138,12 +138,12 @@ class LooseObjectDB(FileDBBase, ObjectDBR, ObjectDBW): # try again without noatime try: return file_contents_ro_filepath(db_path) - except OSError: - raise BadObject(sha) + except OSError as new_e: + raise BadObject(sha) from new_e # didn't work because of our flag, don't try it again self._fd_open_flags = 0 else: - raise BadObject(sha) + raise BadObject(sha) from e # END handle error # END exception handling -- cgit v1.2.1 From 112252cef0d418fd070671e64b18558c2f2cf2f1 Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Sun, 14 Jun 2020 14:35:48 +0300 Subject: Fix exception causes all over the codebase --- gitdb/__init__.py | 4 ++-- gitdb/db/mem.py | 4 ++-- gitdb/util.py | 4 ++-- 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 -- cgit v1.2.1 From c96c755fa30277fbaadf79603a0b4fa1054ce2cb Mon Sep 17 00:00:00 2001 From: Ram Rachum Date: Mon, 15 Jun 2020 10:48:01 +0300 Subject: Add Ram Rachum to AUTHORS --- AUTHORS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/AUTHORS b/AUTHORS index 490baad..6c7e9b9 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1 +1,4 @@ Creator: Sebastian Thiel + +Contributors: + - Ram Rachum (@cool-RR) -- cgit v1.2.1