-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need context access in formatError #2355
Comments
We have the same issue with express. We use the context to know in which language the error should be translated. It would be awesome to have it as a second argument. |
@bigmaster Awesome! That's definitely a helpful workaround to get a usable error formatter. I would still love to see it be a part of the actual exposed function from apollo-server though. Doubly so because I believe the one apollo exposes is actually created the same way that the one you created is! |
|
This comment has been minimized.
This comment has been minimized.
@martijnwalraven The errors of this hook are readonly, what if you need to modify errors with information from the context? |
Applies to:
apollo-server-hapi
(and probably more)The
formatError
function which you can pass intoApolloServer
when starting has no way to gain access tocontext
(orrequest
). In previous versions (the oldgraphql-server-hapi
), we had access to this. In our workflows, this is necessary because we log these errors using the request log (which we have access to incontext
) and then mask the errors going back to the client them depending on the environment. Is there any way you could add the capability to accesscontext
as an argument to this function?The text was updated successfully, but these errors were encountered: