From 21c2db7cdce8ffe32658b515790999d5ba56db99 Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Wed, 6 Apr 2016 12:40:59 -0700 Subject: [PATCH] attempt to make the failed-to-load-entity-script error-message be more helpful --- libraries/script-engine/src/ScriptEngine.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libraries/script-engine/src/ScriptEngine.cpp b/libraries/script-engine/src/ScriptEngine.cpp index 31047dd423..bcd509ff53 100644 --- a/libraries/script-engine/src/ScriptEngine.cpp +++ b/libraries/script-engine/src/ScriptEngine.cpp @@ -1089,9 +1089,18 @@ 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(); + if (testConstructorValue.size() > 80) { + testConstructorValue = testConstructorValue.mid(0, 80) + "..."; + } + qCDebug(scriptengine) << "Error -- ScriptEngine::loadEntityScript() entity:" << entityID + << "failed to load entity script -- expected a function, got " + testConstructorType + << "," << testConstructorValue + << "," << scriptOrURL; if (!isFileUrl) { scriptCache->addScriptToBadScriptList(scriptOrURL);