Commits

Ronald Oussoren  committed 6ffbf9e

better message in exception messages

  • Participants
  • Parent commits 6164ced

Comments (0)

Files changed (1)

File pyobjc-core/Modules/objc/struct-wrapper.m

 		const char* fieldstart;
 
 		if (*sigcur != _C_STRUCT_B) {
-			PyErr_SetString(PyExc_ValueError, "invalid signature");
+			PyErr_SetString(PyExc_ValueError, "invalid signature: not a struct encoding");
 			return NULL;
 		}
 
 		while (*sigcur && *sigcur != _C_STRUCT_E && *sigcur != '=') sigcur++;
 
 		if (!*sigcur || *sigcur == _C_STRUCT_E) {
-			PyErr_SetString(PyExc_ValueError, "invalid signature");
+			PyErr_SetString(PyExc_ValueError, "invalid signature: not a complete struct encoding");
 			return NULL;
 		}
 
 				sigcur++;
 				sigcur = strchr(sigcur, '"');
 				if (sigcur == NULL) {
-					PyErr_SetString(PyExc_ValueError, "invalid signature");
+					PyErr_SetString(PyExc_ValueError, "invalid signature: embedded field name without end");
 					return NULL;
 				}
 				sigcur++;
 			} else {
-				PyErr_SetString(PyExc_ValueError, "invalid signature");
+				PyErr_SetString(PyExc_ValueError, "invalid signature: not all fields have an embedded name");
 				return NULL;
 			}
 			if (*sigcur == _C_STRUCT_E) break;
 				end = strchr(sigcur, '"');
 
 				if (end == NULL) {
-					PyErr_SetString(PyExc_ValueError, "invalid signature");
+					PyErr_SetString(PyExc_ValueError, "invalid signature: embedded field name without end");
 					return NULL;
 				}
 				fieldnames[numFields] = PyMem_Malloc(end - sigcur + 1);