Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: throw a descriptive error when an undefined attribute is used for a... #254

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PK1A
Copy link
Contributor

@PK1A PK1A commented Jul 24, 2014

... component

Fixes #253

I'm afraid that this is the best I can think of doing based on what I can see being available in the context where the error occurs. Obviously we can't provide the original line number:column as a template is compiled but what is kind of not nice is the fact that we can't (?) provide the impacted component name as it is a function and its constructor seems to be an anonymous function...

@b-laporte, are there any other sources of data that I'm not aware of and we could use for better error reporting?

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0%) when pulling 710dfd4 on PK1A:issue253 into 4e0fa3b on ariatemplates:master.

@@ -87,7 +87,9 @@ exports.$CptComponent = {
for (var i = 0, sz = this.atts.length; sz > i; i++) {
att = atts[i];
nm = att.name;
if (this.ctlAttributes[nm].type!=="template") {
if (!this.ctlAttributes || !this.ctlAttributes[nm]) {
throw new Error('The attribute "' + nm + '" was used but the component doesn\'t define this attribute.');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The impacted component name is in this.info, so to be in line with other error messages, this one could be changed to:
throw new Error(this.info + ' The attribute "' + etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing redundant attributes to a component fails the compilation with a cryptic error
3 participants