File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -268,7 +268,16 @@ export class QueryManager {
268
268
} ) ;
269
269
270
270
return result ;
271
+ } )
272
+ . catch ( ( err ) => {
273
+ this . store . dispatch ( {
274
+ type : 'APOLLO_MUTATION_ERROR' ,
275
+ error : err ,
276
+ mutationId,
277
+ resultBehaviors,
278
+ } ) ;
271
279
280
+ return Promise . reject ( err ) ;
272
281
} ) ;
273
282
}
274
283
@@ -685,7 +694,8 @@ export class QueryManager {
685
694
} ) ;
686
695
687
696
this . removeFetchQueryPromise ( requestId ) ;
688
- reject ( new ApolloError ( {
697
+
698
+ return Promise . reject ( new ApolloError ( {
689
699
networkError : error ,
690
700
} ) ) ;
691
701
} ) ;
Original file line number Diff line number Diff line change @@ -96,6 +96,17 @@ export function isMutationResultAction(action: ApolloAction): action is Mutation
96
96
return action . type === 'APOLLO_MUTATION_RESULT' ;
97
97
}
98
98
99
+ export interface MutationErrorAction {
100
+ type : 'APOLLO_MUTATION_ERROR' ;
101
+ error : Error ;
102
+ mutationId : string ;
103
+ resultBehaviors ?: MutationBehavior [ ] ;
104
+ } ;
105
+
106
+ export function isMutationErrorAction ( action : ApolloAction ) : action is MutationErrorAction {
107
+ return action . type === 'APOLLO_MUTATION_ERROR' ;
108
+ }
109
+
99
110
export interface StoreResetAction {
100
111
type : 'APOLLO_STORE_RESET' ;
101
112
observableQueryIds : string [ ] ;
@@ -113,4 +124,5 @@ export type ApolloAction =
113
124
QueryStopAction |
114
125
MutationInitAction |
115
126
MutationResultAction |
127
+ MutationErrorAction |
116
128
StoreResetAction ;
You can’t perform that action at this time.
0 commit comments