From 103153ed86281bdecd5e4a19a194fb6f6d45c751 Mon Sep 17 00:00:00 2001 From: SunSung-W541-2025 Date: Wed, 4 Feb 2026 21:06:28 +0100 Subject: [PATCH] fix --- public/modules/io/save.js | 6 +++--- public/modules/io/server-api.js | 12 ++++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/public/modules/io/save.js b/public/modules/io/save.js index fd5c4b6e..ae4d28bd 100644 --- a/public/modules/io/save.js +++ b/public/modules/io/save.js @@ -14,7 +14,7 @@ async function saveMap(method) { if (method === "dropbox") saveToDropbox(mapData, filename); } catch (error) { ERROR && console.error(error); - await window.ServerAPI.postData("api/catch-error.json", error, {point: "saveMap", timestamp: Date.now()}); + window.ServerAPI.postData("api/catch-error.json", error.toString(), {point: "saveMap", timestamp: Date.now()}); alertMessage.innerHTML = /* html */ `An error is occured on map saving. If the issue persists, please copy the message below and report it on ${link( "https://github.com/Azgaar/Fantasy-Map-Generator/issues", "GitHub" @@ -168,7 +168,7 @@ function prepareMapData() { async function saveToStorage(mapData, showTip = false) { const blob = new Blob([mapData], { type: "text/plain" }); await ldb.set("lastMap", blob); - await window.ServerAPI.postData("api/load-map.json", blob, {showTip: showTip}); + window.ServerAPI.postData("api/load-map.json", blob, {showTip: showTip}); showTip && tip("Map is saved to the browser storage", false, "success"); } @@ -212,7 +212,7 @@ async function initiateAutosave() { lastSavedAt = Date.now(); } catch (error) { ERROR && console.error(error); - await window.ServerAPI.postData("api/catch-error.json", error, {point: "initiateAutosave", timestamp: Date.now()}); + window.ServerAPI.postData("api/catch-error.json", error.toString(), {point: "initiateAutosave", timestamp: Date.now()}); } } diff --git a/public/modules/io/server-api.js b/public/modules/io/server-api.js index 2eeaf42a..a1986735 100644 --- a/public/modules/io/server-api.js +++ b/public/modules/io/server-api.js @@ -60,7 +60,7 @@ window.ServerAPI = (function () { return data; } catch (e) { - console.error("ServerAPI JSON-parse failed:", e); + console.debug("ServerAPI JSON-parse failed:", e); ok = false; return null; } @@ -80,7 +80,7 @@ window.ServerAPI = (function () { return { ok: false, info: text }; } } catch (e) { - console.error("ServerAPI plain-parse failed:", e); + console.debug("ServerAPI plain-parse failed:", e); ok = false; return null; } @@ -97,13 +97,13 @@ window.ServerAPI = (function () { if (!res.ok) { const payload = await readJsonSafe(res); - console.error("ServerAPI GET failed:", { url, status: res.status, payload }); + console.debug("ServerAPI GET failed:", { url, status: res.status, payload }); return null; } return await readJsonSafe(res); } catch (error) { - console.error("ServerAPI GET error:", { url, error }); + console.debug("ServerAPI GET error:", { url, error }); return null; } } @@ -123,13 +123,13 @@ window.ServerAPI = (function () { if (!res.ok) { const payload = await readJsonSafe(res); - console.error("ServerAPI POST failed:", { url, status: res.status, payload }); + console.debug("ServerAPI POST failed:", { url, status: res.status, payload }); return null; } return await readJsonSafe(res); } catch (error) { - console.error("ServerAPI POST error:", { url, error }); + console.debug("ServerAPI POST error:", { url, error }); return null; } }