More descriptive state errors
This commit is contained in:
17
index.js
17
index.js
@@ -83,19 +83,20 @@ window.registerElement = (el, tagname) => {
|
|||||||
let paramName = "$" + param
|
let paramName = "$" + param
|
||||||
if(stateVariables[i] !== paramName) {
|
if(stateVariables[i] !== paramName) {
|
||||||
if(!stateVariables[i]) {
|
if(!stateVariables[i]) {
|
||||||
console.error(`Quill: state ${state} must be initialized`)
|
console.error(`${el.prototype.constructor.name}: state ${state} must be initialized`)
|
||||||
} else {
|
} else {
|
||||||
continue
|
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
|
return
|
||||||
} else {
|
} else {
|
||||||
elem[paramName] = params[0][param]
|
elem[paramName] = params[0][param]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(params[0] !== stateVariables[0]) {
|
if(!params[0] && stateVariables[0]) {
|
||||||
console.error(`Quill: state initializer $${params[0]} should be ${stateVariables[0]}`)
|
console.log(params, stateVariables)
|
||||||
|
console.error(`${el.prototype.constructor.name}: state initializer $${params[0]} should be ${stateVariables[0]}`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
elem[stateVariables[0]] = params[0]
|
elem[stateVariables[0]] = params[0]
|
||||||
@@ -350,4 +351,10 @@ function getSafariVersion() {
|
|||||||
const safariVersion = safariVersionMatch ? parseFloat(safariVersionMatch[1]) : null;
|
const safariVersion = safariVersionMatch ? parseFloat(safariVersionMatch[1]) : null;
|
||||||
return safariVersion;
|
return safariVersion;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* CONSOLE */
|
||||||
|
|
||||||
|
console.red = function(message) {
|
||||||
|
this.log(`%c${message}`, "color: rgb(254, 79, 42);");
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user