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 handling #202
Comments
Which client do you use? It's probably a client issue. |
Ah from the error it looks like |
Yeah, @mattdamon108, do you want to open an issue on In the meantime, maybe try setting your
|
@jfrolich here's my query and schema module Ship = [%graphql
{|
query { shipRequests {
id
user_id
species
quantity
created_at
}
}
|}
]; type Query {
shipRequests: ship_request!
}
type ship_request {
created_at: DateTime!
id: Int!
quantity: String!
species: String!
user_id: Int!
}
|
@jfrolich @jeddeloh I'm still not sure to what this issue belongs, the client.. or ppx.. According my schema, function parse(value) {
if(!value || !value.shipRequests) return // something like this maybe?
var value$1 = value.shipRequests;
return {
shipRequests: {
__typename: value$1.__typename,
id: value$1.id,
user_id: value$1.user_id,
species: value$1.species,
quantity: value$1.quantity,
created_at: value$1.created_at
}
};
} |
What server do you use? It looks like value.shipRequests can never be null, is it violating the protocol? Or is it null because there are some errors? |
@jfrolich I use let getUser = (req: ApolloServer.request) => {
switch req.headers.authorization {
| Some(authorization) => {
try {
authorization
->Js.String2.replace("Bearer ", "")
->verify(jwtSecret)
} catch {
| Js.Exn.Error(e) => {
let name = e->Js.Exn.name->Belt.Option.getWithDefault("ErrorName")
let message = e->Js.Exn.message->Belt.Option.getWithDefault("ErrorMessage")
raise(ApolloServer.authenticationError(name ++ ": " ++ message))
}
}
}
| None => raise(ApolloServer.authenticationError("Authentication Required"))
}
} |
Yes if there is an error it's probably a bug in the client (it shouldn't try to parse the data). |
Hi,
In case of having an error of
GraphQLError
from the gql api, the compiled query code throwing an error such as,I guess what it causes from this part of the compiled code.
In this case,
Ship.use()
alwasy throwing an error. I think this forces me to use the catching JS Exception which I am really not willing to use. Is there any workaround or a good way to avoid it?The text was updated successfully, but these errors were encountered: