From 9335819795b80c0f728b3beb19f060a6636a99f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20David=20Ib=C3=A1=C3=B1ez?= Date: Wed, 5 Apr 2017 22:18:21 +0200 Subject: [PATCH] Opening repos, raise more meaningful exceptions --- src/pygit2.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/pygit2.c b/src/pygit2.c index d62a12a..5db288a 100644 --- a/src/pygit2.c +++ b/src/pygit2.c @@ -159,7 +159,6 @@ init_file_backend(PyObject *self, PyObject *args) } err = git_repository_open(&repository, path); - if (err < 0) { Error_set_str(err, path); goto cleanup; @@ -173,11 +172,7 @@ cleanup: } if (err == GIT_ENOTFOUND) { - PyErr_Format(PyExc_Exception, - "Repository not found at %s", path); - } else { - PyErr_Format(PyExc_Exception, - "Git error %d while opening repo at %s", err, path); + PyErr_Format(GitError, "Repository not found at %s", path); } return NULL;