@@ -10,36 +10,38 @@ import {
1010} from './types' ;
1111
1212export interface ApolloErrorHandlerResultInterface {
13- processedErrors : ProcessedApolloError [ ] ;
13+ allErrors : ProcessedApolloError [ ] ;
1414 validationRuleViolations ?: ValidationRuleViolation [ ] ;
1515}
1616
1717export class ApolloErrorHandlerResult implements ApolloErrorHandlerResultInterface {
18+ public readonly allErrors : ProcessedApolloError [ ] ;
19+
1820 public constructor (
19- public readonly processedErrors : ProcessedApolloError [ ] ,
21+ public readonly unhandledErrors : ProcessedApolloError [ ] ,
2022 public readonly handledErrors : ProcessedApolloError [ ] ,
21- ) { }
23+ ) {
24+ this . allErrors = [ ...unhandledErrors , ...handledErrors ] ;
25+ }
2226
2327 public get networkErrors ( ) : NetworkError [ ] {
24- return this . processedErrors . filter ( ( e ) : e is NetworkError => e . type === ApolloErrorType . NETWORK_ERROR ) ;
28+ return this . allErrors . filter ( ( e ) : e is NetworkError => e . type === ApolloErrorType . NETWORK_ERROR ) ;
2529 }
2630
2731 public get serverErrors ( ) : ServerError [ ] {
28- return this . processedErrors . filter ( ( e ) : e is ServerError => e . type === ApolloErrorType . SERVER_ERROR ) ;
32+ return this . allErrors . filter ( ( e ) : e is ServerError => e . type === ApolloErrorType . SERVER_ERROR ) ;
2933 }
3034
3135 public get unauthorizedErrors ( ) : UnauthorizedError [ ] {
32- return this . processedErrors . filter ( ( e ) : e is UnauthorizedError => e . type === ApolloErrorType . UNAUTHORIZED_ERROR ) ;
36+ return this . allErrors . filter ( ( e ) : e is UnauthorizedError => e . type === ApolloErrorType . UNAUTHORIZED_ERROR ) ;
3337 }
3438
3539 public get userInputErrors ( ) : UserInputError [ ] {
36- return this . processedErrors . filter ( ( e ) : e is UserInputError => e . type === ApolloErrorType . BAD_USER_INPUT ) ;
40+ return this . allErrors . filter ( ( e ) : e is UserInputError => e . type === ApolloErrorType . BAD_USER_INPUT ) ;
3741 }
3842
3943 public get inputValidationErrors ( ) : InputValidationError [ ] {
40- return this . processedErrors . filter (
41- ( e ) : e is InputValidationError => e . type === ApolloErrorType . INPUT_VALIDATION_ERROR ,
42- ) ;
44+ return this . allErrors . filter ( ( e ) : e is InputValidationError => e . type === ApolloErrorType . INPUT_VALIDATION_ERROR ) ;
4345 }
4446
4547 public get validationRuleViolations ( ) : ValidationRuleViolation [ ] {
0 commit comments