added Error_set_exc() for throwing individual Exceptions
This commit is contained in:
@@ -34,6 +34,7 @@
|
||||
|
||||
PyObject* Error_type(int type);
|
||||
PyObject* Error_set(int err);
|
||||
PyObject* Error_set_exc(PyObject* exception);
|
||||
PyObject* Error_set_str(int err, const char *str);
|
||||
PyObject* Error_set_oid(int err, const git_oid *oid, size_t len);
|
||||
|
||||
|
@@ -92,6 +92,17 @@ PyObject* Error_set(int err)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PyObject* Error_set_exc(PyObject* exception)
|
||||
{
|
||||
const git_error* error = giterr_last();
|
||||
char* message = (error == NULL) ?
|
||||
"(No error information given)" : error->message;
|
||||
PyErr_SetString(exception, message);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
PyObject* Error_set_str(int err, const char *str)
|
||||
{
|
||||
const git_error* error;
|
||||
|
Reference in New Issue
Block a user