Opening repos, raise more meaningful exceptions
This commit is contained in:
parent
784583d21e
commit
9335819795
@ -159,7 +159,6 @@ init_file_backend(PyObject *self, PyObject *args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = git_repository_open(&repository, path);
|
err = git_repository_open(&repository, path);
|
||||||
|
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
Error_set_str(err, path);
|
Error_set_str(err, path);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -173,11 +172,7 @@ cleanup:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (err == GIT_ENOTFOUND) {
|
if (err == GIT_ENOTFOUND) {
|
||||||
PyErr_Format(PyExc_Exception,
|
PyErr_Format(GitError, "Repository not found at %s", path);
|
||||||
"Repository not found at %s", path);
|
|
||||||
} else {
|
|
||||||
PyErr_Format(PyExc_Exception,
|
|
||||||
"Git error %d while opening repo at %s", err, path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user