Hey guys
We have moved recently in our react-native side from Meteor to react-apollo w/ graphql.
Now, in the web app, we are still using Meteor.
Currently, we throw exceptions with throw new Meteor.error(...)
.
But, when we use a mutation in the rn side, we get error like:
Error: GraphQL error: OUR_CAUSE_OF_ERROR. [404]
.
Now, i can use string.replace and mutate this string, but i dont think it’s the best practice…
Does any1 here has a suggestion how to handle correctly the erros? maybe throw an other type of error? thx in advance
loginWithPassword({ email, password }, client).then( res => {
client.resetStore()
callback(null, true);
}).catch( err => {
const errors = err.graphQLErrors.map( err => err.message ); //will give you an array of all the error messages
callback(errors);
return dispatch({ type: HANDLE_LOGIN });
});
If you need more flexibility on the GraphQL side, graphql-apollo-errors
offers more flexible error reporting to the client.