I am currently utilizing the inversify-express-utils
library.
Let's say I have a controller action that is responsible for retrieving a User
entity:
@httpGet("/:id")
public async getUser(): Promise<User> {
try {
const id = this.httpContext.request.params.id;
return await this._userRepository.get(id);
}
catch (e) {
this.httpContext.response.status(404);
// ...what should be included here?
}
}
I understand that I can exclude the return type, but I prefer not to bypass the type system.
So, what should I include in the catch block?