Skip to content

Commit 80caa4a

Browse files
committed
Rename response to result in onError link. Rename type
1 parent c2b248b commit 80caa4a

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

src/link/error/index.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@ import {
1111
import type { FetchResult, NextLink, Operation } from "@apollo/client/link";
1212
import { ApolloLink } from "@apollo/client/link";
1313

14-
export interface ErrorResponse {
15-
/**
16-
* Error that caused the callback to be triggered.
17-
*/
18-
error: ErrorLike;
19-
response?: FetchResult;
20-
operation: Operation;
21-
forward: NextLink;
22-
}
23-
2414
export namespace ErrorLink {
2515
/**
2616
* Callback to be triggered when an error occurs within the link stack.
2717
*/
2818
export interface ErrorHandler {
29-
(error: ErrorResponse): Observable<FetchResult> | void;
19+
(error: ErrorHandlerOptions): Observable<FetchResult> | void;
20+
}
21+
22+
export interface ErrorHandlerOptions {
23+
/**
24+
* Error that caused the callback to be triggered.
25+
*/
26+
error: ErrorLike;
27+
result?: FetchResult;
28+
operation: Operation;
29+
forward: NextLink;
3030
}
3131
}
3232

@@ -51,14 +51,14 @@ export function onError(errorHandler: ErrorHandler): ApolloLink {
5151
if (errors) {
5252
retriedResult = errorHandler({
5353
error: new CombinedGraphQLErrors(result, errors),
54-
response: result,
54+
result,
5555
operation,
5656
forward,
5757
});
5858
} else if (graphQLResultHasProtocolErrors(result)) {
5959
retriedResult = errorHandler({
6060
error: result.extensions[PROTOCOL_ERRORS_SYMBOL],
61-
response: result,
61+
result,
6262
operation,
6363
forward,
6464
});

0 commit comments

Comments
 (0)