enhanced argc reporting

in a method argc out of bounds scenario, report how many it got, and what range it expected
This commit is contained in:
AzaezelX 2024-05-01 18:20:14 -05:00
parent 0f32ae256e
commit 1ea74bf8c6
2 changed files with 2 additions and 2 deletions

View file

@ -1173,7 +1173,7 @@ ConsoleValue Namespace::Entry::execute(S32 argc, ConsoleValue *argv, SimObject *
if ((mMinArgs && argc < mMinArgs) || (mMaxArgs && argc > mMaxArgs))
{
Con::warnf(ConsoleLogEntry::Script, "%s::%s - wrong number of arguments.", mNamespace->mName, mFunctionName);
Con::warnf(ConsoleLogEntry::Script, "%s::%s - wrong number of arguments. got %d, expected %d to %d", mNamespace->mName, mFunctionName, argc, mMinArgs, mMaxArgs);
Con::warnf(ConsoleLogEntry::Script, "usage: %s", mUsage);
return std::move(ConsoleValue());
}

View file

@ -1909,7 +1909,7 @@ Con::EvalResult CodeBlock::exec(U32 ip, const char* functionName, Namespace* thi
if ((nsEntry->mMinArgs && S32(callArgc) < nsEntry->mMinArgs) || (nsEntry->mMaxArgs && S32(callArgc) > nsEntry->mMaxArgs))
{
const char* nsName = ns ? ns->mName : "";
Con::warnf(ConsoleLogEntry::Script, "%s: %s::%s - wrong number of arguments.", getFileLine(ip - 4), nsName, fnName);
Con::warnf(ConsoleLogEntry::Script, "%s: %s::%s - wrong number of arguments. got %d, expected %d to %d", getFileLine(ip - 4), nsName, fnName, S32(callArgc), nsEntry->mMinArgs, nsEntry->mMaxArgs);
Con::warnf(ConsoleLogEntry::Script, "%s: usage: %s", getFileLine(ip - 4), nsEntry->mUsage);
gCallStack.popFrame();
stack[_STK + 1].setEmptyString();