History

Some V8 debuging messages

ksuprynowicz committed 3 years ago

Commit cc20ced1 parent da458cc4 files · +24 −3Browse files

Showing the changes to libraries/script-engine/src/v8/ScriptValueV8Wrapper.cpp (1 of 4 files). Show all

Unified · Split

libraries/script-engine/src/v8/ScriptValueV8Wrapper.cpp+10−3
@@ -206,7 +206,7 @@ ScriptValue ScriptValueV8Wrapper::property(quint32 arrayIndex, const ScriptValue · 205 unmodified lines
206206 return ScriptValue(new ScriptValueV8Wrapper(_engine, std::move(result)));
207207 }
208208 }
209− qCritical() << "Failed to get property, parent of value: " << arrayIndex << " is not a V8 object, reported type: " << QString(*v8::String::Utf8Value(isolate, _value.constGet()->TypeOf(isolate)));
209+ qDebug() << "Failed to get property, parent of value: " << arrayIndex << " is not a V8 object, reported type: " << QString(*v8::String::Utf8Value(isolate, _value.constGet()->TypeOf(isolate)));
210210 return _engine->undefinedValue();
211211 /*v8::Local<v8::Value> nullValue = v8::Null(_engine->getIsolate());
212212 V8ScriptValue nullScriptValue(_engine->getIsolate(), std::move(nullValue));
@@ -241,7 +241,14 @@ void ScriptValueV8Wrapper::setProperty(const QString& name, const ScriptValue& v · 28 unmodified lines
241241 qDebug(scriptengine) << "Failed to set property";
242242 }
243243 } else {
244− qDebug(scriptengine) << "Failed to set property - parent is not an object";
244+ v8::Local<v8::String> details;
245+ QString detailsString("");
246+ if(_value.get()->ToDetailString(_engine->getContext()).ToLocal(&details)) {
247+ v8::String::Utf8Value utf8Value(isolate,details);
248+ detailsString = *utf8Value;
249+ }
250+ qDebug(scriptengine) << "Failed to set property:" + name + " - parent is not an object. Parent details: " + " Type: " + QString(*v8::String::Utf8Value(isolate, _value.constGet()->TypeOf(isolate)));
251+ qDebug(scriptengine) << _engine->currentContext()->backtrace();
245252 }
246253 //V8TODO: what about flags?
247254 //_value.setProperty(name, unwrapped, (V8ScriptValue::PropertyFlags)(int)flags);
@@ -260,7 +267,7 @@ void ScriptValueV8Wrapper::setProperty(quint32 arrayIndex, const ScriptValue& va · 12 unmodified lines
260267 qDebug(scriptengine) << "Failed to set property";
261268 }
262269 } else {
263− qDebug(scriptengine) << "Failed to set property - parent is not an object";
270+ qDebug(scriptengine) << "Failed to set property: " + QString(arrayIndex) + " - parent is not an object";
264271 }
265272 //V8TODO: what about flags?
266273 //_value.setProperty(arrayIndex, unwrapped, (V8ScriptValue::PropertyFlags)(int)flags);