summaryrefslogtreecommitdiff
path: root/src/object.c
diff options
context:
space:
mode:
authorJakob Pfender <jpfender@elegosoft.com>2011-05-18 12:19:48 +0200
committerVicent Marti <tanoku@gmail.com>2011-05-23 21:04:19 +0300
commit75eb97fed0e3a4d9797dda081eccc858643c5fe4 (patch)
tree49c129de6bbc976e78fc4d16f240215b330f1812 /src/object.c
parent0be7f000a5dd434f2d319250a046e3a82a9e0707 (diff)
downloadlibgit2-75eb97fed0e3a4d9797dda081eccc858643c5fe4.tar.gz
object.c: Move to new error handling mechanism
Diffstat (limited to 'src/object.c')
-rw-r--r--src/object.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/object.c b/src/object.c
index 0572663eb..e4d9da044 100644
--- a/src/object.c
+++ b/src/object.c
@@ -86,7 +86,7 @@ static int create_object(git_object **object_out, git_otype type)
break;
default:
- return GIT_EINVALIDTYPE;
+ return git__throw(GIT_EINVALIDTYPE, "Failed to create object. Given type is invalid");
}
object->type = type;
@@ -106,7 +106,7 @@ int git_object_lookup(git_object **object_out, git_repository *repo, const git_o
object = git_cache_get(&repo->objects, id);
if (object != NULL) {
if (type != GIT_OBJ_ANY && type != object->type)
- return GIT_EINVALIDTYPE;
+ return git__throw(GIT_EINVALIDTYPE, "Failed to lookup object. Given type does not match found type");
*object_out = object;
return GIT_SUCCESS;
@@ -114,17 +114,17 @@ int git_object_lookup(git_object **object_out, git_repository *repo, const git_o
error = git_odb_read(&odb_obj, repo->db, id);
if (error < GIT_SUCCESS)
- return error;
+ return git__rethrow(error, "Failed to lookup object");
if (type != GIT_OBJ_ANY && type != odb_obj->raw.type) {
git_odb_object_close(odb_obj);
- return GIT_EINVALIDTYPE;
+ return git__throw(GIT_EINVALIDTYPE, "Failed to lookup object. Given type does not match found type");
}
type = odb_obj->raw.type;
if ((error = create_object(&object, type)) < GIT_SUCCESS)
- return error;
+ return git__rethrow(error, "Failed to lookup object");
/* Initialize parent object */
git_oid_cpy(&object->cached.oid, id);
@@ -155,7 +155,7 @@ int git_object_lookup(git_object **object_out, git_repository *repo, const git_o
if (error < GIT_SUCCESS) {
git_object__free(object);
- return error;
+ return git__rethrow(error, "Failed to lookup object");
}
*object_out = git_cache_try_store(&repo->objects, object);