Skip to content

Commit 6eb97a2

Browse files
committed
Include headers in GitHubError, refs #79
1 parent 2e84e26 commit 6eb97a2

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

github_to_sqlite/utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,17 @@
7474

7575

7676
class GitHubError(Exception):
77-
def __init__(self, message, status_code):
77+
def __init__(self, message, status_code, headers=None):
7878
self.message = message
7979
self.status_code = status_code
80+
self.headers = headers
8081

8182
@classmethod
8283
def from_response(cls, response):
8384
message = response.json()["message"]
8485
if "git repository is empty" in message.lower():
8586
cls = GitHubRepositoryEmpty
86-
return cls(message, response.status_code)
87+
return cls(message, response.status_code, response.headers)
8788

8889

8990
class GitHubRepositoryEmpty(GitHubError):

0 commit comments

Comments
 (0)