fail fast for wrong message parameters

simplifies debugging
This commit is contained in:
Steffen Mecke 2016-05-31 01:48:21 +02:00
parent 5535beed61
commit 96b7c92d81
1 changed files with 2 additions and 0 deletions

View File

@ -194,6 +194,7 @@ message *msg_message(const char *name, const char *sig, ...)
} }
else { else {
log_error("invalid parameter %s for message type %s\n", paramname, mtype->name); log_error("invalid parameter %s for message type %s\n", paramname, mtype->name);
assert(!"invalid parameter for message type");
} }
while (*ic && !isalnum(*ic)) while (*ic && !isalnum(*ic))
ic++; ic++;
@ -201,6 +202,7 @@ message *msg_message(const char *name, const char *sig, ...)
va_end(vargs); va_end(vargs);
if (argnum != mtype->nparameters) { if (argnum != mtype->nparameters) {
log_error("not enough parameters for message type %s\n", mtype->name); log_error("not enough parameters for message type %s\n", mtype->name);
assert(!"not enough parameters for message type");
} }
return msg_create(mtype, args); return msg_create(mtype, args);