"But Nathan!" you may say. "But Nathan, errors are bad! They aren't 
SuperSnazzy at all!"

Well, that's true. But the errors I'm talking about aren't Haml's or 
Sass'. They're mine and yours. Simple things, like forgetting a space, 
adding an extra closing brace, setting the contents of a tag twice, 
accidentally using tab characters. We're humans, not machines - that's 
why we're using Haml in the first place.

Well, no longer will Haml and Sass blithely pass over our mistakes, 
trying as best as possible to parse them and usually causing our 
templates to come out looking like something RHTML dragged in. No - now 
both Haml and Sass will raise a big, fat SyntaxError* whenever it 
encounters a mistake, alerting us not only that there was an error, but 
what it was and where it was in the file. In Haml's case, this is enough 
for ActionView to format the error into the all-to-familiar, but quite 
helpful, error dialog. Because ActionView isn't involved in rendering 
Sass, the Sass engine itself formats an error view. For example,

#main
  :width 15em
  :color

would cause

/*
Sass::SyntaxError: Invalid attribute: ":color "
on line 3 of script/../config/../public/stylesheets/sass/test.sass

1: #main
2:   :width 15em
3:   :color


Backtrace:
<< Boring backtrace stuff >>
*/

to show up in the Sass file.

This should hugely decrease the amount of time we have to spend rooting 
through our files, trying to figure out why that <a> isn't rendering 
inside that <div>, and why that damn constant just isn't being parsed. 
If you find anything that you think should be throwing an error but 
isn't, please let us know. Likewise, if you think an error isn't clear 
enough, we'd love to hear suggestions.

This is already implemented in trunk, and will be in Haml as of version 1.5.

- Nathan

* Actually Haml::SyntaxError and Sass::SyntaxError, so as not to 
conflict with the toplevel SyntaxError class.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to