lovell / lovell/sharp

Error codes on errors?

Open
#562 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
JavaScript
Stars
32.7k
Forks
1.4k
Avg merge
1d 14h
Merged PRs (30d)
5

Description

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)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing sharp's current error handling and Node's EACCES/ENOENT error-code conventions. Done means errors expose stable machine-readable codes so callers can distinguish failures without matching message substrings.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.