I'm using the inversify-express-utils
package.
Suppose I have a controller action that returns 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 goes here?
}
}
I know I can omit the return type, but I don't want to circumvent the type system.
So what do I return from that catch block?