Browse files

Fix some Tree error messages.

Change-Id: Ic72c307436d2e1abb610ac8a3dab26f1c4995255
  • Loading branch information...
1 parent 673a045 commit db1e4ace376de29846a508daba13980da4044e97 @dborowitz dborowitz committed Nov 5, 2010
Showing with 6 additions and 2 deletions.
  1. +6 −2 pygit2.c
View
8 pygit2.c
@@ -874,7 +874,9 @@ Tree_getitem(Tree *self, PyObject *value) {
} else if (PyInt_Check(value)) {
return Tree_getitem_by_index(self, value);
} else {
- PyErr_SetString(PyExc_TypeError, "Expected int or str for tree index.");
+ PyErr_Format(PyExc_TypeError,
+ "Tree entry index must be int or str, not %.200s",
+ value->ob_type->tp_name);
return NULL;
}
}
@@ -920,7 +922,9 @@ Tree_delitem(Tree *self, PyObject *name, PyObject *value) {
} else if (PyInt_Check(name)) {
return Tree_delitem_by_index(self, name);
} else {
- PyErr_SetString(PyExc_TypeError, "Expected int or str for tree index.");
+ PyErr_Format(PyExc_TypeError,
+ "Tree entry index must be int or str, not %.200s",
+ value->ob_type->tp_name);
return -1;
}
}

0 comments on commit db1e4ac

Please sign in to comment.