Last active
January 30, 2023 18:00
-
-
Save rutvikbhatt9/0194fb0eae469b5d9cb351063957c474 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { onError } from "@apollo/client/link/error"; | |
const error = onError((error) => { | |
const { graphQLErrors, networkError, operation } = error; | |
if (graphQLErrors) { | |
console.log('GRAPH QL ERROR', graphQLErrors); | |
if (!graphQLErrors[0].message) { | |
console.log('Something went wrong', graphQLErrors[0].name); | |
} else { | |
console.log("Error message", graphQLErrors[0].message); | |
} | |
} else if (networkError) { | |
console.log('NETWORK ERROR', networkError); | |
// Network issue like data or wifi is off or not connected | |
console.log('Something went wrong in network error'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment