mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
feat(server): introduce user friendly server errors (#7111)
This commit is contained in:
@@ -195,9 +195,9 @@ export const gqlFetcherFactory = (
|
||||
const result = (await res.json()) as ExecutionResult;
|
||||
if (res.status >= 400 || result.errors) {
|
||||
if (result.errors && result.errors.length > 0) {
|
||||
throw result.errors.map(
|
||||
error => new GraphQLError(error.message, error)
|
||||
);
|
||||
// throw the first error is enough
|
||||
const firstError = result.errors[0];
|
||||
throw new GraphQLError(firstError.message, firstError);
|
||||
} else {
|
||||
throw new GraphQLError('Empty GraphQL error body');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user