sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Error codes on errors?

Open rexxars opened this issue 7 years ago • 1 comments

First of all, thanks for a super well made project - I love it.

I'm trying to handle any errors that sharp encounter in a graceful way, but I can't find any way to differentiate errors other than checking for substrings in the error messages, which seem brittle.

Would it be possible to add a code property to the errors, in the same way that node does? (EACCES, ENOENT et all)

rexxars avatar Sep 03 '16 19:09 rexxars

Hei Espen, this will definitely be a useful feature, thank you for the suggestion.

Many errors originate from libvips itself and won't have a code so a substring-based approach may still be required, at least internally.

I guess the first step is to list all the possible error conditions.

lovell avatar Sep 03 '16 21:09 lovell