apollo-errors: Spec compliant error
Recently, GraphQL Response Specification got updated with a suggestion to place custom data in error in the extensions
object. The spec can be found here https://github.com/facebook/graphql/blob/master/spec/Section 7 -- Response.md
An excerpt of the relevant section:
GraphQL services may provide an additional entry to errors with key
extensions
. This entry, if set, must have a map as its value. This entry is reserved for implementors to add additional information to errors however they see fit, and there are no additional restrictions on its contents.
{
"errors": [
{
"message": "Name for character with ID 1002 could not be fetched.",
"locations": [ { "line": 6, "column": 7 } ],
"path": [ "hero", "heroFriends", 1, "name" ],
"extensions": {
"code": "CAN_NOT_FETCH_BY_ID",
"timestamp": "Fri Feb 9 14:33:09 UTC 2018"
}
}
]
}
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 2
- Comments: 19 (12 by maintainers)
Can we create a second PR for this? I’d like to release in 2.0
@thebigredgeek I’m using this heavily in a few projects and plan on releasing an open source boilerplate that includes it, I’m more than willing to help maintain it.
Sorry I miss this message. I’ll try send a PR your way today or tomorrow!
@thebigredgeek How can I help resolve this issue and get V2 published? Right now we’re monkey-patching the error response object at the last second as a workaround. Should we switch over to a different package that is better supported? Thanks for any help. cc: @jonesmac @tarazena @mwlevel20
This should be against version 2 should it not? I think that was why I reverted originally, too much push back about the breaking change.