libvips / lua-vips

Lua binding for the libvips image processing library
MIT License
125 stars 10 forks source link

Throw a more informative error on invalid flag #45

Closed RiskoZoSlovenska closed 2 years ago

RiskoZoSlovenska commented 2 years ago

Passing an invalid flag to an operation throws a very uninformative bad argument #1 to 'band' (number expected, got nil) error. This PR checks for invalid flags and throws a much cleaner error, detailing the name of the invalid flag. As an example, calling flatten with "nonsense" as a flag would result in unable to call operation flatten: invalid flag 'nonsense'.

jcupitt commented 2 years ago

Hi @RiskoZoSlovenska, that's a nice improvement, thanks!