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

Throw parse errors instead of just logging them to console #41

Open
jarek-foksa opened this issue Aug 4, 2016 · 3 comments
Open

Throw parse errors instead of just logging them to console #41

jarek-foksa opened this issue Aug 4, 2016 · 3 comments

Comments

@jarek-foksa
Copy link

This way the parser could be used to validate properties and attributes, e.g.:

let isValidStyleAttributeValue = (value) => {
  try {
    CSSParser.parseAListOfDeclarations(value.trim());  
  }
  catch (error) {
    return false;
  }

  return true;
};
@tabatkins
Copy link
Owner

I wouldn't want to do that in general - one of CSS's nice features is that it'll parse any byte sequence you throw at it. But yeah, having some way to indicate that there was indeed a parse error would be nice for validation purposes.

@jarek-foksa
Copy link
Author

jarek-foksa commented Aug 26, 2016

But the parser is already throwing some parse errors, it would make more sense to either throw all parse errors or none at all.

@tabatkins
Copy link
Owner

You're right, I should definitely be consistent between the two.

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

No branches or pull requests

2 participants