Oh, and one more: (What a busy day :slightly_smili...
# orm-help
m
Oh, and one more: (What a busy day 🙂) How can I add an http error code (401) when throwing an error as a response to an unauthorized request in my typescript yoga service?
n
A GraphQL server is not communicating with HTTP errors, usually they would return status code
200
, even for application or authorization errors. Nevertheless, you can simply add that kind of error handling logic on the express layer, not the yoga layer, as you would do with any other express server (using a middleware, I suppose).
m
Ok, thanks!
@nilan I think no middleware is needed here. After some trial & error, I was able to accomplish what I wanted by setting
Copy code
context.response.status(401);
in my resolver. Thanks again!
👌 1