-
Notifications
You must be signed in to change notification settings - Fork 85
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
feat(typescript): expose type
property for errors in graphql response errors
#314
Conversation
…se errors GraphQL response errors can have a `type` field that can be useful for error detection. e.g. if a pull request does not exist there is an error with the `NOT_FOUND` type.
Hi Paul, I just checked and confirmed the Example query {
repository(owner: "gr2m", name: "sandbox") {
pullRequest(number: 999) {
id
}
}
} yields {
"data": {
"repository": {
"pullRequest": null
}
},
"errors": [
{
"type": "NOT_FOUND",
"path": [
"repository",
"pullRequest"
],
"locations": [
{
"line": 3,
"column": 5
}
],
"message": "Could not resolve to a PullRequest with the number of 999."
}
]
} But you say the |
@gr2m Thanks for checking! (yeah I was checking some queries, like for the pull request and saw this property) Sorry for the confusion. I was proposing we could make it |
I think it's probably always set. Can you please ask in https://git.luolix.topmunity/c/github-ecosystem/37, or send a message to support at https://support.github.com/contact? Either should give us an answer from GitHub. You can reference your pull request |
I've just sent a ticket. I'll keep you updated. |
@gr2m I just received the response:
It sounds like
I've replied and checked on that, but I assume that will not change any time soon, as it would/might break some services relying on the GraphQL API returning |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot 💐
🎉 This PR is included in version 4.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
GraphQL response errors can have a
type
field that can be usefulfor error detection. e.g. if a pull request does not exist there is
an error with the
NOT_FOUND
type.@gr2m maybe you could help with this here. I have not found any official specification from Github on this, but I see feature requests for this in other Github GraphQL libraries and I can see it in various requests from Github. We could also type this as potentially
undefined
? I lack information here unfortunately.