diff --git a/src/js/popup.js b/src/js/popup.js index 2d63395..6e8fa1e 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -1085,16 +1085,16 @@ Logic.registerPanel(P_CONTAINER_EDIT, { window.proxifiedContainers.set(identity.cookieStoreId, DEFAULT_PROXY, error.error === "uninitialized").then((result) => { edit_proxy_dom(result.proxy); }, (error) => { - window.proxifiedContainers.report_proxy_error(error); + window.proxifiedContainers.report_proxy_error(error, "popup.js: occurence 1"); }).catch((error) => { - window.proxifiedContainers.report_proxy_error(error); + window.proxifiedContainers.report_proxy_error(error, "popup.js: occurence 2"); }); } else { - window.proxifiedContainers.report_proxy_error(error); + window.proxifiedContainers.report_proxy_error(error, "popup.js: occurence 3"); } - }).catch((error) => { - window.proxifiedContainers.report_proxy_error(error); + }).catch((err) => { + window.proxifiedContainers.report_proxy_error(err, "popup.js: occurence 4"); }); return Promise.resolve(null); diff --git a/src/js/proxified-containers.js b/src/js/proxified-containers.js index eb94519..a6bd6b6 100644 --- a/src/js/proxified-containers.js +++ b/src/js/proxified-containers.js @@ -16,9 +16,10 @@ window.proxifiedContainers = { }); }, - report_proxy_error: function(error) { + report_proxy_error: function(error, identifier = null) { //Currently I print to console but this is inefficient - browser.extension.getBackgroundPage().console.log("proxifiedContainers error occured: " + JSON.stringify(error)); + const relevant_id_str = identifier === null ? "" : " call supplied with id: " + identifier.toString() + " "; + browser.extension.getBackgroundPage().console.log("proxifiedContainers error occured" + relevant_id_str + ": " + JSON.stringify(error)); }, //Resolves to a proxy object which can be used in the return of the listener required for browser.proxy.onRequest.addListener @@ -42,7 +43,8 @@ window.proxifiedContainers = { resolve(results_array); } else { const val = results_array.find(o => o.cookieStoreId === cookieStoreId); - if (val === null) { + + if (typeof val !== "object" ) { reject({ error: "doesnotexist", message: "" @@ -58,7 +60,7 @@ window.proxifiedContainers = { message: error }); }).catch((error) => { - window.proxifiedContainers.report_proxy_error(error); + window.proxifiedContainers.report_proxy_error(error, "5"); }); }); },