From dbf4d7cb19cfdbbd25d52ad287d779ee4f569cac Mon Sep 17 00:00:00 2001 From: metacryst Date: Mon, 11 Mar 2024 12:24:27 -0500 Subject: [PATCH] More descriptive state errors --- index.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 5c5228b..a866389 100644 --- a/index.js +++ b/index.js @@ -83,19 +83,20 @@ window.registerElement = (el, tagname) => { let paramName = "$" + param if(stateVariables[i] !== paramName) { if(!stateVariables[i]) { - console.error(`Quill: state ${state} must be initialized`) + console.error(`${el.prototype.constructor.name}: state ${state} must be initialized`) } else { continue } - console.error(`Quill: state initializer ${i} ${paramName} should be ${stateVariables[0]}`) + console.error(`${el.prototype.constructor.name}: state initializer ${i} ${paramName} should be ${stateVariables[0]}`) return } else { elem[paramName] = params[0][param] } } } else { - if(params[0] !== stateVariables[0]) { - console.error(`Quill: state initializer $${params[0]} should be ${stateVariables[0]}`) + if(!params[0] && stateVariables[0]) { + console.log(params, stateVariables) + console.error(`${el.prototype.constructor.name}: state initializer $${params[0]} should be ${stateVariables[0]}`) return } elem[stateVariables[0]] = params[0] @@ -350,4 +351,10 @@ function getSafariVersion() { const safariVersion = safariVersionMatch ? parseFloat(safariVersionMatch[1]) : null; return safariVersion; } -} \ No newline at end of file +} + +/* CONSOLE */ + +console.red = function(message) { + this.log(`%c${message}`, "color: rgb(254, 79, 42);"); +}; \ No newline at end of file