loopbackio / loopbackio/loopback-next

Enable custom reject implementation to leverage the built-in "code to statusCode" mapping

Open
#1,942 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Extensions feature good first issue help wanted
Dominant language
TypeScript
Stars
5.1k
Forks
1.1k
Avg merge
2d 21h
Merged PRs (30d)
27

Description

Users wishing to provide their own implementation of `reject` action need a way how to decide which HTTP status code to use depending on the error code, e.g. to map error code `ENTITY_NOT_FOUND` to status code `404`.

See also the discussion in https://github.com/strongloop/loopback-next/issues/1867

## Acceptance criteria

- [ ] A public API allowing custom `reject` implementations to map error codes to status codes
- [ ] A new subsection in [Handling errors](https://loopback.io/doc/en/lb4/Sequence.html#handling-errors) explaining how to write a custom `reject` implementation

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 with the Handling errors subsection in the linked Sequence documentation and review the discussion in issue #1867. Then locate the existing reject implementation and built-in code-to-statusCode mapping. Done means a public mapping API is available to custom reject implementations and the documentation explains how to use it.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.