Opening repos, raise more meaningful exceptions

This commit is contained in:
J. David Ibáñez 2017-04-05 22:18:21 +02:00
parent 784583d21e
commit 9335819795
1 changed files with 1 additions and 6 deletions

View File

@ -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;