diff --git a/src/js/utilsDOM.js b/src/js/utilsDOM.js index 6f50cef3864c5674bf4976392fc7df1043c1438b..d11b42132c043a9032d435b6f93cd7c7f8481817 100644 --- a/src/js/utilsDOM.js +++ b/src/js/utilsDOM.js @@ -121,7 +121,6 @@ App.UI.DOM.disabledLink = function(link, reasons) { return res; }; - /** * @template {keyof HTMLElementTagNameMap} K * @param {K} tag - valid HTML tag @@ -476,18 +475,27 @@ App.UI.DOM.formatException = function formatException(ex, recursion = false) { function render() { const fragment = document.createDocumentFragment(); - App.UI.DOM.appendNewElement("p", fragment, - `${ex.name}: ${ex.message}; Passage: ${passage()}; Version: ${Config.saves.version}`, ["bold", "error"]); + const header = document.createElement("p"); + header.classList.add("error"); + App.UI.DOM.appendNewElement("div", header, `Apologies! An error has occurred. Please report this.`, "bold"); + App.UI.DOM.appendNewElement("div", header, `Please provide a screenshot of the error message, a save file and any other relevant information.`); + fragment.append(header); + + App.UI.DOM.appendNewElement("p", fragment, `Passage: ${passage()}; Version: ${Config.saves.version}`, "bold"); + + const error = document.createElement("p"); + App.UI.DOM.appendNewElement("div", error, `${ex.name}: ${ex.message}`, "bold"); - const p = document.createElement("p"); + const body = document.createElement("div"); const lines = ex.stack.split("\n"); for (const ll of lines) { const div = document.createElement("div"); // remove file path from error message div.append(ll.replace(/file:.*\//, "<path>/")); - p.append(div); + body.append(div); } - fragment.append(p); + error.append(body); + fragment.append(error); return fragment; }