-
Notifications
You must be signed in to change notification settings - Fork 722
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
Current limitations in GraphQLError #39
Comments
(Responding here instead of on the PR for context.) Thanks for bringing this up! I agree adding I also see why custom error keys would be useful, but forcing users to specify a custom error type seems like a very heavyweight solution. Swift doesn't support default type arguments, so your PR would force you to always fully specify the type parameters of Instead of custom error types, an alternative might be to modify extension GraphQLError {
var userMessage: String? {
return self["userMessage"] as? String
}
} How does that sound? |
Good call on the light-weight solution you've proposed -- it seems like it'll be better for most consumers of this library. I hadn't noticed the inconvenience since I only use I'll go ahead and close #40. Implementing this is not something I've got steam for right now, but perhaps in the future. |
I implemented the solution we discussed as part of f77286f. |
@martijnwalraven I'm implementing the GraphQLError extension you suggested above, xcode complains on the
Is there something I'm missing? |
@benrom: This was only recently added and is not not in the patch 0.4.3 version yet. |
Thanks to all who have contributed to this fantastic library.
It would be great to be able to be able to have more flexibility when reading from a GraphQL response's
errors
array. Specifically:locations
as an key in a GraphQL error in addition tomessage
. It seems straight forward add alocations
key toGraphQLError
.userMessage
-- a message that's guaranteed to be presentable to the user). To do so, it seems like adding an additional type parameter toGraphQLResult
resulting inGraphQLResult<Data, ErrorType>
(sadly, plainError
already exists in the namespace), thus allowing consumers ofapollo-ios
to define their own error types. This is clearly a more involved change, but is crucial to my own usage ofapollo-ios
.Lastly, an certainly least importantly, the aforelinked spec section also mentions:
Thus, it seems like an
enum
might be better suited for this task rather thandata
anderrors
both being optionals. Result is a good example of this, and on potential implementation would be forGraphQLError
to have a property of typeResult
.The text was updated successfully, but these errors were encountered: