I am trying to prevent any error thrown from my server crash the browser. I have tried with try-catch but also with the apollo-link-error's onError Link. The behaviour I am looking for is , instead of crashing the app , display something from my client. What I have tried:
onSubmit={(values)=>
try{
logIn({variables:{"name":values.name,"email":values.email}})
}catch(err){
return (err)
}
if(error) return <p>An error occured</p>
But also with apollo-link-error:
const errorLink=onError(({graphQLError,networkError})=>{
if(graphQLError){
return "There was a problem"
}
}
The errorLink only does throw this error in my console , but it does not also present the behaviour I had hoped: prevent the app from crashing. Could you please let me know what to do?