Skip to content

Commit 9b0d0e0

Browse files
committed
Add ApolloErrorProcessor.result getter
1 parent e7396ee commit 9b0d0e0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/error/ApolloErrorProcessor.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
ServerError,
1010
UnauthorizedError,
1111
} from './types';
12+
import { ApolloErrorHandlerResult } from './ApolloErrorHandlerResult';
1213

1314
export function isApolloError(error: ApolloError | any): error is ApolloError {
1415
return error.graphQLErrors !== undefined;
@@ -25,11 +26,12 @@ export class ApolloErrorProcessor<TApp = Vue, TContext = ApolloOperationContext>
2526
INTERNAL_SERVER_ERROR: `A server error has occurred.`,
2627
};
2728

28-
public processedErrors: ProcessedApolloError[];
29+
public readonly processedErrors: ProcessedApolloError[];
2930

3031
protected readonly originalError: Error;
3132
protected readonly app: TApp;
3233
protected readonly context: TContext;
34+
protected handledErrors: ProcessedApolloError[] = [];
3335

3436
public constructor(error: ApolloError, app: TApp, context: TContext) {
3537
this.originalError = error;
@@ -39,6 +41,10 @@ export class ApolloErrorProcessor<TApp = Vue, TContext = ApolloOperationContext>
3941
this.processedErrors = this.processApolloError(error);
4042
}
4143

44+
public get result(): ApolloErrorHandlerResult {
45+
return new ApolloErrorHandlerResult(this.processedErrors, this.handledErrors);
46+
}
47+
4248
public showErrorNotifications(): void {
4349
// This is just an example - to do something else (e.g. showing a visible notification to the user), you should
4450
// implement your own class that extends ApolloErrorProcessor and replace this showErrorNotifications method.

0 commit comments

Comments
 (0)