-
Notifications
You must be signed in to change notification settings - Fork 6
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
Error types are inaccurate #476
Comments
Hello @knowlesc and thanks for writing in! I'm not an expert in TypeScript, but doesn't that error you're showing adhere to the
Am I wrong about this or was there something else you were expecting? It's hard to anticipate all the myriad errors that we may encounter, so I'm not sure that there's a realistic way to code for all of them. Let me know your thoughts, please. |
Hi @newhouse - thanks for the quick response. This behaviour is technically accurate, however it doesn't make it clear which keys will be included. An When that executes, we have a set of clearly defined error keys (name, message, code, cause, stack). The response error type would be clearer if it was something like:
where
At least this way, consumers can understand that errors may come back in that format, and build their error handlers to specifically handle those types of errors, without having to dig into the library code. Hopefully my description makes sense - let me know if you have any questions. |
OK, that sounds good. I added this in |
Going to close this for now. |
the
GraphQLResponse
type is defined like this:However, if there's an internal node error, which we occasionally see ("Premature close"), the response looks like this:
It would be great if we could rely on the error types to be able to safely parse errors.
Thank you!
The text was updated successfully, but these errors were encountered: