Skip to content

Commit

Permalink
Merge pull request #20 from LauraBeatris/update-error-type
Browse files Browse the repository at this point in the history
Update type of error parameter from getErrors and getErrorMessage
  • Loading branch information
pedro-lb authored Aug 14, 2020
2 parents 148dbfb + 5496596 commit 3123fdc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion package/src/utils/getErrorMessage.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ApolloError } from '@apollo/client';
import { ErrorResponse } from '@apollo/client/link/error';

import getErrorsList from './getErrorsList';
Expand All @@ -7,7 +8,7 @@ import getErrorsList from './getErrorsList';
* @param error The query error.
*/
const getErrorMessage = (
error: ErrorResponse,
error: ErrorResponse | ApolloError,
) => {
const errors = getErrorsList(error);

Expand Down
3 changes: 2 additions & 1 deletion package/src/utils/getErrorsList.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { ErrorResponse } from '@apollo/client/link/error';
import { ApolloError } from '@apollo/client';

/**
* Sanitizes a query error, returning a list of errors to be displayed.
* @param error The query error.
*/
const getErrorsList = (
error: ErrorResponse,
error: ErrorResponse | ApolloError,
) => {
if (error?.networkError) {
return ['Network Error'];
Expand Down

0 comments on commit 3123fdc

Please sign in to comment.