Added unhandled error handler to display any uncaught errors to the user.

This commit is contained in:
itdominator 2024-05-12 21:36:29 -05:00
parent 27e6890d04
commit bf254f1d03
5 changed files with 26 additions and 9 deletions

View File

@ -4,8 +4,8 @@ Easy Session Manager allows you to manage your Firefox session by backing up or
# Download # Download
https://addons.mozilla.org/en-US/firefox/addon/easy-session-manager/ https://addons.mozilla.org/en-US/firefox/addon/easy-session-manager/
# Version: 0.2.3.6 # Version: 0.2.3.7
* Updated in place tab loading logic * Added unhandled error handler to display any uncaught errors to the user.
# Images # Images

View File

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Easy Session Manager", "name": "Easy Session Manager",
"version": "0.2.3.6", "version": "0.2.3.7",
"description": "Easy Session Manager allows you to manage your Firefox session by backing up or loading your saved sessions.", "description": "Easy Session Manager allows you to manage your Firefox session by backing up or loading your saved sessions.",
"browser_specific_settings": { "browser_specific_settings": {

View File

@ -1,4 +1,20 @@
window.onload = (eve) => {
console.log("Loaded...");
getSavedSessionIDs(); getSavedSessionIDs();
}
window.onerror = function(msg, url, line, col, error) {
// Note that col & error are new to the HTML 5 spec and may not be supported in every browser.
let suppressErrorAlert = false;
let extra = !col ? '' : '\ncolumn: ' + col;
extra += !error ? '' : '\nerror: ' + error;
const data = `Error: ${msg} \nurl: ${url} \nline: ${line} ${extra}`
messageWindow("danger", data, "", -1);
// If you return true, then error alerts (like in older versions of Internet Explorer) will be suppressed.
return suppressErrorAlert;
};
document.addEventListener("click", (e) => { document.addEventListener("click", (e) => {
if (e.button == 0) { // Left click if (e.button == 0) { // Left click

View File

@ -256,7 +256,6 @@ const loadSession = (json = null, replaceTabs = false) => {
} }
: { }; : { };
tabsApi.create(createOption).catch( async (e) => { tabsApi.create(createOption).catch( async (e) => {
createOption.url = returnReplaceURL( createOption.url = returnReplaceURL(
"open_faild", "open_faild",

View File

@ -1,7 +1,7 @@
let selectedItem = null; let selectedItem = null;
const messageWindow = (type = "warning", message = "No message passed in...", target = "") => { const messageWindow = (type = "warning", message = "No message passed in...", target = "", timeout = 3200) => {
let pTag = document.createElement("P"); let pTag = document.createElement("P");
let text = document.createTextNode(message); let text = document.createTextNode(message);
let gutter = document.getElementById("message-gutter"); let gutter = document.getElementById("message-gutter");
@ -14,9 +14,11 @@ const messageWindow = (type = "warning", message = "No message passed in...", ta
pTag.appendChild(text); pTag.appendChild(text);
gutter.prepend(pTag); gutter.prepend(pTag);
timeout = (timeout === -1) ? 6200 : (timeout > 0) ? timeout : 3200;
setTimeout(function () { setTimeout(function () {
clearChildNodes(gutter); clearChildNodes(gutter);
}, 3200); }, timeout);
} }