diff --git a/static/webui/script.js b/static/webui/script.js index 200bc040..8c88a69a 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -3552,16 +3552,21 @@ function doPopArchonCrystalUpgrade(type) { function doImport() { revalidateAuthz().then(() => { - $.post({ - url: "/custom/import?" + window.authz, - contentType: "application/json", - data: JSON.stringify({ - inventory: JSON.parse($("#import-inventory").val()) - }) - }).then(function () { - toast(loc("code_succImport")); - updateInventory(); - }); + try { + $.post({ + url: "/custom/import?" + window.authz, + contentType: "application/json", + data: JSON.stringify({ + inventory: JSON.parse($("#import-inventory").val()) + }) + }).then(function () { + toast(loc("code_succImport")); + updateInventory(); + }); + } catch (e) { + toast(e); + console.error(e); + } }); }