History

attempt to make the failed-to-load-entity-script error-message be more helpful

Seth Alves committed 10 years ago

Commit 21c2db71 parent e76a0491 file · +12 −3Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 1 file). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+12−3
@@ -1089,9 +1089,18 @@ void ScriptEngine::entityScriptContentAvailable(const EntityItemID& entityID, co · 1088 unmodified lines
1089 }1089 }
1090 1090
1091 if (!testConstructor.isFunction()) {1091 if (!testConstructor.isFunction()) {
1092 qCDebug(scriptengine) << "ScriptEngine::loadEntityScript() entity:" << entityID << "\n"1092 QString testConstructorType = QString(testConstructor.toVariant().typeName());
1093 " NOT CONSTRUCTOR\n"1093 if (testConstructorType == "") {
1094 " SCRIPT:" << scriptOrURL;1094 testConstructorType = "empty";
1095 }
1096 QString testConstructorValue = testConstructor.toString();
1097 if (testConstructorValue.size() > 80) {
1098 testConstructorValue = testConstructorValue.mid(0, 80) + "...";
1099 }
1100 qCDebug(scriptengine) << "Error -- ScriptEngine::loadEntityScript() entity:" << entityID
1101 << "failed to load entity script -- expected a function, got " + testConstructorType
1102 << "," << testConstructorValue
1103 << "," << scriptOrURL;
1095 1104
1096 if (!isFileUrl) {1105 if (!isFileUrl) {
1097 scriptCache->addScriptToBadScriptList(scriptOrURL);1106 scriptCache->addScriptToBadScriptList(scriptOrURL);