mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 23:07:59 +02:00
Merge pull request #7600 from sethalves/fix-entity-script-error-message
attempt to make the failed-to-load-entity-script error-message be more helpful
This commit is contained in:
commit
ce1625b551
1 changed files with 13 additions and 3 deletions
|
@ -1124,9 +1124,19 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co
|
|||
}
|
||||
|
||||
if (!testConstructor.isFunction()) {
|
||||
qCDebug(scriptengine) << "ScriptEngine::loadEntityScript() entity:" << entityID << "\n"
|
||||
" NOT CONSTRUCTOR\n"
|
||||
" SCRIPT:" << scriptOrURL;
|
||||
QString testConstructorType = QString(testConstructor.toVariant().typeName());
|
||||
if (testConstructorType == "") {
|
||||
testConstructorType = "empty";
|
||||
}
|
||||
QString testConstructorValue = testConstructor.toString();
|
||||
const int maxTestConstructorValueSize = 80;
|
||||
if (testConstructorValue.size() > maxTestConstructorValueSize) {
|
||||
testConstructorValue = testConstructorValue.mid(0, maxTestConstructorValueSize) + "...";
|
||||
}
|
||||
qCDebug(scriptengine) << "Error -- ScriptEngine::loadEntityScript() entity:" << entityID
|
||||
<< "failed to load entity script -- expected a function, got " + testConstructorType
|
||||
<< "," << testConstructorValue
|
||||
<< "," << scriptOrURL;
|
||||
|
||||
if (!isFileUrl) {
|
||||
scriptCache->addScriptToBadScriptList(scriptOrURL);
|
||||
|
|
Loading…
Reference in a new issue