loopbackio / loopbackio/loopback-next
Enable custom reject implementation to leverage the built-in "code to statusCode" mapping
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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