Skip to content

Commit

Permalink
align NetworkError and GraphQLErrors types
Browse files Browse the repository at this point in the history
  • Loading branch information
korywka authored and brainkim committed Sep 28, 2021
1 parent 34b41a0 commit 1f2ced4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ const generateErrorMessage = (err: ApolloError) => {
return message;
};

export type GraphQLErrors = ReadonlyArray<GraphQLError>;

export type NetworkError = Error | ServerParseError | ServerError | null;

export class ApolloError extends Error {
public message: string;
public graphQLErrors: ReadonlyArray<GraphQLError>;
public graphQLErrors: GraphQLErrors;
public clientErrors: ReadonlyArray<Error>;
public networkError: Error | ServerParseError | ServerError | null;

Expand Down
12 changes: 5 additions & 7 deletions src/link/error/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { GraphQLError, ExecutionResult } from 'graphql';
import { ExecutionResult } from 'graphql';

import { ApolloLink, Operation, FetchResult, NextLink } from '../core';
import { NetworkError, GraphQLErrors } from '../../errors';
import { Observable } from '../../utilities';

import { ServerError } from '../utils';
import { ServerParseError } from '../http';
import { ApolloLink, Operation, FetchResult, NextLink } from '../core';

export interface ErrorResponse {
graphQLErrors?: ReadonlyArray<GraphQLError>;
networkError?: Error | ServerError | ServerParseError;
graphQLErrors?: GraphQLErrors;
networkError?: NetworkError;
response?: ExecutionResult;
operation: Operation;
forward: NextLink;
Expand Down

0 comments on commit 1f2ced4

Please sign in to comment.