I'm writing a Mongoose/Koa/Typescript API. I'm wondering what the best way to pass errors from the db level (for example a broken unique rule), through a service layer (a collection of async methods that container business logic and talk to the DB), then to a Koa route. What is the best way to pass up errors and give appropriate response codes, as well as messages such as 'user already exists?
Submitted July 24, 2019 at 09:38AM by AmateurLlama
No comments:
Post a Comment