NuxtN
Nuxt3y ago
BT1010

Handling @nuxt/apollo response 400 from graph query

I use @nuxt/apollo for handling graph and in my index.vue I do:
try {
  const { result } = useQuery(query, variables)
} catch (e) {
  console.log('error', e)
}

It works and fetch my data but when I return 400 from graph it's crashing entire app with this screen (screenshot). How do I handle the issue? It's okey that graph sometimes return 400, I don't want entire app to crash

  const app = useNuxtApp()
  const { data } = await app.$apollo.defaultClient.query({query, variables})

this on the other hand doesn't crash the page when received 400
image.png
Was this page helpful?