[{"_path":"/recipes/error-handling","_draft":false,"_partial":false,"_empty":false,"title":"Error Handling","description":"Capture GraphQL errors and handle them accordingly.","excerpt":{"type":"root","children":[{"type":"element","tag":"h2","props":{"id":"error-policy"},"children":[{"type":"text","value":"Error Policy"}]},{"type":"element","tag":"h2","props":{"id":"error-hook"},"children":[{"type":"text","value":"Error Hook"}]},{"type":"element","tag":"p","props":{},"children":[{"type":"text","value":"Nuxt Apollo provides a nuxt hook named "},{"type":"element","tag":"code-inline","props":{},"children":[{"type":"text","value":"apollo:error"}]},{"type":"text","value":" which captures errors encountered by apollo client(s)."}]},{"type":"element","tag":"code","props":{"code":"export default defineNuxtPlugin((nuxtApp) => {\n nuxtApp.hook('apollo:error', (error) => {\n console.error(error)\n\n // Handle different error cases\n })\n})\n","filename":"plugins/apollo.ts","language":"ts"},"children":[{"type":"element","tag":"pre","props":{},"children":[{"type":"element","tag":"code","props":{"__ignoreMap":""},"children":[{"type":"text","value":"export default defineNuxtPlugin((nuxtApp) => {\n nuxtApp.hook('apollo:error', (error) => {\n console.error(error)\n\n // Handle different error cases\n })\n})\n"}]}]}]}]},"_type":"markdown","_id":"content:2.recipes:2.error-handling.md","_source":"content","_file":"2.recipes/2.error-handling.md","_extension":"md"},null]