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

Error not catched in css-parse #1

Open
tkjaergaard opened this issue Mar 4, 2014 · 5 comments
Open

Error not catched in css-parse #1

tkjaergaard opened this issue Mar 4, 2014 · 5 comments

Comments

@tkjaergaard
Copy link

When css-parse encounters an error it throws a new Error object which is not caught in index,js:125

This causes the watch workflow in Gulp to crash due to an unhandled error and is also resulting the .on('error') event not to be triggered.

Please look at some options to catch the error and throw a PluginError instead?

@konitter
Copy link
Owner

@tkjaergaard Hi.

I do not know well how to receive the error css-parse can throw.

https://github.com/reworkcss/css-parse#errors

I do think I think we can deal with such a situation to add code similar to the following, but do you intent not match the thing you are you said?

var cssJson = parseCss(source);

try {
  file.contents = new Buffer(cssJson);
} catch (err) {
  this.emit('error', new PluginError(PLUGIN_NAME, err));
}

@tkjaergaard
Copy link
Author

That could be a valid solution to overcome this issue?

@konitter
Copy link
Owner

Since try if the problem can be solved, why not tell me the CSS code that has a problem css-parse such that an error?

@tkjaergaard
Copy link
Author

Sorry mate, but what you just wrote doesn't make any sense to me? :)

@mistergraphx
Copy link

Hi, i just encountered a similar issue. but the error message in the terminal give me the line where it crash. In fact the parser crash in my case, with a missing ';' at the end of the class declaration.this can be considered as correct in a css validation normaly.

.thumbnails li.thumbnail {
  display: block;
  padding: 0.3125em;
  margin-bottom: 1.2em;
  line-height: 23px;
  background-color: white;
  border: 1px solid silver;
  border-radius: 5px
}

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

3 participants