Skip to content

Commit 3aefe6d

Browse files
committed
如果exposed方法在脚本中没有给出exposedID参数,则在出错时给出明确的提示。
1 parent 42cf48a commit 3aefe6d

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

‎kbe/src/lib/entitydef/method.cpp‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ PyObject* MethodDescription::createFromStream(MemoryStream* mstream)
217217

218218
if(pyitem == NULL)
219219
{
220-
WARNING_MSG(fmt::format("MethodDescription::createFromStream:{} arg[{}][{}] is NULL.\n",
220+
WARNING_MSG(fmt::format("MethodDescription::createFromStream: {} arg[{}][{}] is NULL.\n",
221221
this->getName(), index, argTypes_[index]->getName()));
222222
}
223223

@@ -255,7 +255,18 @@ PyObject* MethodDescription::call(PyObject* func, PyObject* args)
255255
}
256256
}
257257

258-
SCRIPT_ERROR_CHECK();
258+
if (PyErr_Occurred())
259+
{
260+
if (isExposed() && PyErr_ExceptionMatches(PyExc_TypeError))
261+
{
262+
WARNING_MSG(fmt::format("MethodDescription::call: {} is method of exposed, if there is a missing arguments error, "
263+
"try adding exposedID, For example: \ndef func(msg): => def func(exposedID, msg):\n",
264+
this->getName()));
265+
}
266+
267+
PyErr_PrintEx(0);
268+
}
269+
259270
return pyResult;
260271
}
261272

0 commit comments

Comments
 (0)