less.js icon indicating copy to clipboard operation
less.js copied to clipboard

Invalid color to function throws `color.toHSL is not a function`

Open matthew-dean opened this issue 6 years ago • 3 comments

See: https://github.com/mediafreakch/less-plugin-sass2less/issues/1#issuecomment-414817753 and #3338.

It looks like rather than throwing an error when an argument to a color function is not valid, some recent changes instead throw a color.toHSL conversion error, which confuses stylesheet authors. It seems it's still valid to throw an error, it's just the wrong error.

matthew-dean avatar Dec 07 '18 16:12 matthew-dean

some recent changes instead throw a color.toHSL conversion error

It's been always like that, there're just one or two functions of all that really test if the input arg is a valid color and throw a friendly error.

seven-phases-max avatar Dec 07 '18 19:12 seven-phases-max

@seven-phases-max oh? I was worried it was a knock-on bug from some changes to color functions I did for 3.5. Is it not worth looking into then?

matthew-dean avatar Dec 07 '18 21:12 matthew-dean

I was worried it was a knock-on bug from some changes to color functions

Well, you just added a few more functions to the "unfriendly list" (previously all those functions of the rgba family did not accept colors at all). But, nothing new really.

seven-phases-max avatar Dec 08 '18 03:12 seven-phases-max