How to Format Errors in GraphQL

preview_player
Показать описание
Avoid leaking confidential information by formatting GraphQL errors.

----

----

----

----
Follow Me Online Here:

#benawad

----
#benawad
Рекомендации по теме
Комментарии
Автор

Lol, every time I'm researching a solution for a problem, you come out with a video about it within 48 hours.

kekddd
Автор

Would this not hide server specific errors such as ValidationError? since we would need to check `error instanceof ApolloError` for those? If so, do we just add an `or` check?

MatiEsme
Автор

Thank you Ben sir.. One awesome package is Apollo errors where we can create a custom error with a message and additional data like status codes it's very handy...

arsalanshaikh
Автор

Should you not return an ApolloError instead of a graphql error? I think this method also strips out the default error code too so it's probably a good idea to return new ApolloError("Internal server error", "INTERNAL_SERVER_ERROR"). What do you think?

riccoski
Автор

Doesn't it only log the stack in dev mode?

yurrwithme