added GIT_EINVALIDSPEC as error code and use error msg for expected failures
This commit is contained in:
@@ -50,6 +50,10 @@ PyObject * Error_type(int type)
|
|||||||
case GIT_EBUFS:
|
case GIT_EBUFS:
|
||||||
return PyExc_ValueError;
|
return PyExc_ValueError;
|
||||||
|
|
||||||
|
/** Invalid input spec */
|
||||||
|
case GIT_EINVALIDSPEC:
|
||||||
|
return PyExc_ValueError;
|
||||||
|
|
||||||
/** Skip and passthrough the given ODB backend */
|
/** Skip and passthrough the given ODB backend */
|
||||||
case GIT_PASSTHROUGH:
|
case GIT_PASSTHROUGH:
|
||||||
return GitError;
|
return GitError;
|
||||||
@@ -79,17 +83,7 @@ PyObject* Error_set(int err)
|
|||||||
{
|
{
|
||||||
assert(err < 0);
|
assert(err < 0);
|
||||||
|
|
||||||
if(err != GIT_ERROR) { //expected failure
|
return Error_set_exc(Error_type(err));
|
||||||
PyErr_SetNone(Error_type(err));
|
|
||||||
} else { //critical failure
|
|
||||||
const git_error* error = giterr_last();
|
|
||||||
char* message = (error == NULL) ?
|
|
||||||
"(No error information given)" : error->message;
|
|
||||||
|
|
||||||
PyErr_SetString(Error_type(err), message);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* Error_set_exc(PyObject* exception)
|
PyObject* Error_set_exc(PyObject* exception)
|
||||||
|
Reference in New Issue
Block a user