File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import {Toaster} from "sonner";
1919import { Error } from "@code0-tech/sagittarius-graphql-types" ;
2020import { toast } from "@code0-tech/pictor" ;
2121import { Inter } from 'next/font/google'
22+ import { GraphQLFormattedError } from "graphql/error" ;
2223
2324/**
2425 * Load the Inter font with Latin subset and swap display strategy
@@ -66,8 +67,8 @@ const ErrorCodeDescription: Record<string, string> = {
6667/**
6768 * Handles error toasts based on error type
6869 */
69- const toastHandler = ( error : Error ) => {
70- if ( error . __typename === "ErrorCode" ) {
70+ const toastHandler = ( error : Error | GraphQLFormattedError ) => {
71+ if ( error && "errorCode" in error ) {
7172 toast ( {
7273 title : ErrorCodeDescription [ ( error . errorCode as string ) ] ,
7374 color : "error" ,
@@ -94,7 +95,7 @@ export default function RootLayout({children}: Readonly<{ children: React.ReactN
9495 */
9596 const errorLink = new ErrorLink ( ( { error, result, operation, forward} ) => {
9697 if ( error instanceof CombinedGraphQLErrors ) {
97- error . errors . forEach ( ( error : Error ) => {
98+ error . errors . forEach ( ( error : GraphQLFormattedError ) => {
9899 toastHandler ( error )
99100 } )
100101 return
You can’t perform that action at this time.
0 commit comments