mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-03 06:03:21 +03:00
fix: handle gql error correctly (#7507)
This commit is contained in:
parent
b50c57a3fa
commit
1f50c1b890
@ -1,6 +1,6 @@
|
|||||||
import { notify } from '@affine/component';
|
import { notify } from '@affine/component';
|
||||||
|
import { GraphQLError } from '@affine/graphql';
|
||||||
import { assertExists } from '@blocksuite/global/utils';
|
import { assertExists } from '@blocksuite/global/utils';
|
||||||
import { GraphQLError } from 'graphql';
|
|
||||||
import type { PropsWithChildren, ReactNode } from 'react';
|
import type { PropsWithChildren, ReactNode } from 'react';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import type { SWRConfiguration } from 'swr';
|
import type { SWRConfiguration } from 'swr';
|
||||||
|
@ -26,7 +26,12 @@ export class UserFriendlyError implements UserFriendlyErrorResponse {
|
|||||||
return new UserFriendlyError(response.extensions);
|
return new UserFriendlyError(response.extensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof response === 'object' && response.type && response.name) {
|
if (
|
||||||
|
response &&
|
||||||
|
typeof response === 'object' &&
|
||||||
|
response.type &&
|
||||||
|
response.name
|
||||||
|
) {
|
||||||
return new UserFriendlyError(response);
|
return new UserFriendlyError(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import type { ExecutionResult } from 'graphql';
|
import type { ExecutionResult } from 'graphql';
|
||||||
import { GraphQLError } from 'graphql';
|
|
||||||
import { isNil, isObject, merge } from 'lodash-es';
|
import { isNil, isObject, merge } from 'lodash-es';
|
||||||
|
|
||||||
|
import { GraphQLError } from './error';
|
||||||
import type { GraphQLQuery } from './graphql';
|
import type { GraphQLQuery } from './graphql';
|
||||||
import type { Mutations, Queries } from './schema';
|
import type { Mutations, Queries } from './schema';
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user