gss / parser

Constraint Cascading Style Sheets compiler
MIT License
48 stars 6 forks source link

Better error reporting #10

Closed paulyoung closed 10 years ago

paulyoung commented 10 years ago

This is a first pass at this. I decided to work against the CoffeeScript port I have going, for now.

I targeted the browser (over the command line) for formatting of the message. Here's how it looks in the JavaScript console in Chrome:

screen shot 2014-05-28 at 13 34 04

This implementation still uses console.error. Throwing errors doesn't allow such nice formatting from what I can tell, but that doesn't mean we shouldn't do that also. Relates to the-gss/engine#75.

I'm starting to think that this should be a separate module so that other components can reuse it.

paulyoung commented 10 years ago

@d4tocchini - would love your feedback whenever you get a moment.

Inviz commented 10 years ago

Nice thing. Errors generated by PEGs sometimes are confusing.

d4tocchini commented 10 years ago

Awesome!

Definitely should be able to use across parsers. On that note, I can see a usability edge case in https://github.com/the-gss/compiler where a VFL statement seems valid but the generated CCSS is not... Should error message show the whole line of VFL and where the generated CCSS line is invalid?

paulyoung commented 10 years ago

I may or may not merge this in, but in any case I'll create a new repo, etc based on this.

paulyoung commented 10 years ago

I can see a usability edge case in https://github.com/the-gss/compiler where a VFL statement seems valid but the generated CCSS is not

Could you provide an example?

Should error message show the whole line of VFL and where the generated CCSS line is invalid?

My initial reaction is that the VFL compiler should report this and show the line of VFL before it ever gets to the CCSS compiler.

Currently, it would also fall through to the CCSS compiler and be reported there since we're not throwing errors at the moment.

I'm not so familiar with the VFL compiler so I could be missing some insight here.

paulyoung commented 10 years ago

Closing this in favor of using a shared module.