From b99b12d3c5e70e810b26ae30819162d6e3892789 Mon Sep 17 00:00:00 2001 From: Dave Borowitz Date: Thu, 4 Nov 2010 15:17:13 -0700 Subject: [PATCH] Fix a few exception returns. Change-Id: Ibb36fd6c14450dfb436ee545b1a91e44b8b2f8cb --- pygit2.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pygit2.c b/pygit2.c index 8b8ea68..8a4a5e8 100644 --- a/pygit2.c +++ b/pygit2.c @@ -195,7 +195,7 @@ static Object *wrap_object(git_object *obj, Repository *repo) { assert(0); } if (!py_obj) - return NULL; + return (Object*)PyErr_NoMemory(); py_obj->obj = obj; py_obj->repo = repo; @@ -219,11 +219,11 @@ Repository_getitem(Repository *self, PyObject *value) { } obj = git_repository_lookup(self->repo, &oid, GIT_OBJ_ANY); - if (!obj) { - PyErr_Format(PyExc_RuntimeError, "Failed to look up hex SHA \"%s\"", - hex); - return NULL; - } + /* Grr, libgit2 currently doesn't give us any info on this error, so we + * can't even tell the difference between a missing object and, say, an I/O + * error. */ + if (!obj) + return Error_set_py_str(GIT_ENOTFOUND, value); py_obj = wrap_object(obj, self); if (!py_obj)