From 71c03883b50b98441ce457fb3cec1701a2e11842 Mon Sep 17 00:00:00 2001 From: "Alon Zakai (kripken)" Date: Sat, 11 Aug 2018 09:49:19 -0700 Subject: [PATCH] use console.warn instead of Module.printErr: emscripten no longer exports printErr by default, and instead err() should be used in code seen by the optimizer; however, as Godot only runs on the Web (and not in node.js or elsewhere), using console.warn directly is good enough, and will work in all versions if emscripten --- platform/javascript/http_request.js | 6 +++--- platform/javascript/javascript_eval.cpp | 4 ++-- platform/javascript/os_javascript.cpp | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/javascript/http_request.js b/platform/javascript/http_request.js index c420052e545..ee1c06c6239 100644 --- a/platform/javascript/http_request.js +++ b/platform/javascript/http_request.js @@ -82,7 +82,7 @@ var GodotHTTPRequest = { godot_xhr_send_string: function(xhrId, strPtr) { if (!strPtr) { - Module.printErr("Failed to send string per XHR: null pointer"); + console.warn("Failed to send string per XHR: null pointer"); return; } GodotHTTPRequest.requests[xhrId].send(UTF8ToString(strPtr)); @@ -90,11 +90,11 @@ var GodotHTTPRequest = { godot_xhr_send_data: function(xhrId, ptr, len) { if (!ptr) { - Module.printErr("Failed to send data per XHR: null pointer"); + console.warn("Failed to send data per XHR: null pointer"); return; } if (len < 0) { - Module.printErr("Failed to send data per XHR: buffer length less than 0"); + console.warn("Failed to send data per XHR: buffer length less than 0"); return; } GodotHTTPRequest.requests[xhrId].send(HEAPU8.subarray(ptr, ptr + len)); diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp index 2ef88345f60..07b4c192e6c 100644 --- a/platform/javascript/javascript_eval.cpp +++ b/platform/javascript/javascript_eval.cpp @@ -69,7 +69,7 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { eval_ret = eval(UTF8ToString(CODE)); } } catch (e) { - Module.printErr(e); + console.warn(e); eval_ret = null; } @@ -97,7 +97,7 @@ Variant JavaScript::eval(const String &p_code, bool p_use_global_exec_context) { if (array_ptr!==0) { _free(array_ptr) } - Module.printErr(e); + console.warn(e); // fall through } break; diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index b9d586e2337..a2c6bdd629c 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -788,7 +788,7 @@ bool OS_JavaScript::main_loop_iterate() { /* clang-format off */ EM_ASM( FS.syncfs(function(err) { - if (err) { Module.printErr('Failed to save IDB file system: ' + err.message); } + if (err) { console.warn('Failed to save IDB file system: ' + err.message); } }); ); /* clang-format on */