diff --git a/gui/scripts/logging.JS b/gui/scripts/logging.JS new file mode 100644 index 0000000..a9c4665 --- /dev/null +++ b/gui/scripts/logging.JS @@ -0,0 +1,25 @@ +/* +logging.JS +Send messages for logging. +*/ + +export default class logging { + /* + Raise an error message. + + @param {number} ERROR_CODE the error code + @param {number} ERROR_MESSAGE the custom error message + */ + static error(ERROR_CODE, ERROR_MESSAGE, critical = true) { + (async () => { + // Import the templating. + const texts = await import(chrome.runtime.getURL("gui/scripts/read.JS")); + + // Display the error message. + console.error(texts.read(`error_msg`, [ERROR_CODE, ERROR_MESSAGE])); + if (critical) { + alert(texts.read(`error_msg_GUI`, [String(ERROR_CODE)])) + }; + })(); + } +}