hagopj13 / hagopj13/node-express-boilerplate

Throwing ApiError from service

Open
#26 4 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
7.7k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

HI @hagopj13, first of all thank you for this boilerplate, it's very useful.
I'm not an expert, but I have a question related to error throwing. Is it a good practice to throw specific error like ApiError from the service layer? I always thought that this kind of error belong to the controller, while the service shouldn't know that the caller is talking using HTTP. Am i wrong? Thank you.

Contributor guide

Open the contributing guide

Research direction

No file, test, or entry point is named. Start by tracing how ApiError is created and handled across the service and controller layers, then review the existing error-handling conventions. Done would require a decided architectural approach and corresponding documentation or implementation scope.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript, node.js
Domain
api, backend, backend-api-design
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
18/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.