JohnAlbin / chroma

Chroma: The Sass color manager
http://johnalbin.github.io/chroma/
GNU General Public License v2.0
40 stars 7 forks source link

Provide more debug-friendly error messages #24

Open artfulrobot opened 8 years ago

artfulrobot commented 8 years ago

I removed a colour from the definition (or I misspelled a colour name) and I get this error:

Message:
    node_modules/chroma-sass/sass/chroma/_functions.scss
Error: The color "watermark" was not found.
        on line 170 of node_modules/chroma-sass/sass/chroma/_functions.scss
>>     @error 'The #{$_chroma-spelling} "#{$name}" was not found.';
   ----^

This does not tell me where the error was encountered - except some internal reference to the chroma code.

It would be nice if it said

"line 1234 of sass/components/yourfile.scss references colour 'watermark' but this is not defined."

or such.

JohnAlbin commented 8 years ago

I agree, but I have no idea how to accomplish this. Sass adds the line number and file name to where the Chroma code calls @error, but, afaik, Chroma doesn't have access to the line number and file name of the calling code.