Feature request: expose HTTP status code on `RepositoryError`

Open
#479 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
typescript
Domain
api

Research direction

Start by locating RepositoryError and the code that creates repository errors from HTTP responses; no file or test path is named in the issue. Inspect existing error tests, then add coverage showing that available status codes are exposed while errors without one remain valid. Done means callers can read the status code for HTTP failures, including the stated 404, 401/403, and server-error cases.

Written by the indexing model from the issue text.

Description

It would be helpful if RepositoryError exposed the underlying HTTP status code when available.

Applications may need to handle different failure cases differently, e.g. 404 Not found, 401/403 permission denied, and 500 or other server errors.

Currently callers can inspect the error message/reason, but it's not straightforward to extract the actual status code from there.

I propose adding an optional property such as statusCode?: number to RepositoryError and ensuring repository errors created from HTTP responses populate it.

Related issues

  • #142
Dominant language
TypeScript
Stars
20
Forks
11
Avg merge
2d 5h
Merged PRs (30d)
1

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.

More from IQSS/dataverse-client-javascript

All issues in IQSS/dataverse-client-javascript

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.