File tree 1 file changed +23
-8
lines changed
1 file changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -129,19 +129,34 @@ export class Store {
129
129
return
130
130
}
131
131
132
- this . _actionSubscribers
133
- . filter ( sub => sub . before )
134
- . forEach ( sub => sub . before ( action , this . state ) )
132
+ try {
133
+ this . _actionSubscribers
134
+ . filter ( sub => sub . before )
135
+ . forEach ( sub => sub . before ( action , this . state ) )
136
+ } catch ( e ) {
137
+ if ( process . env . NODE_ENV !== 'production' ) {
138
+ console . warn ( `[vuex] error in before action subscribers: ` )
139
+ console . error ( e )
140
+ }
141
+ }
135
142
136
143
const result = entry . length > 1
137
144
? Promise . all ( entry . map ( handler => handler ( payload ) ) )
138
145
: entry [ 0 ] ( payload )
139
146
140
- result . then ( ( ) => this . _actionSubscribers
141
- . filter ( sub => sub . after )
142
- . forEach ( sub => sub . after ( action , this . state ) ) )
143
-
144
- return result
147
+ return result . then ( res => {
148
+ try {
149
+ this . _actionSubscribers
150
+ . filter ( sub => sub . after )
151
+ . forEach ( sub => sub . after ( action , this . state ) )
152
+ } catch ( e ) {
153
+ if ( process . env . NODE_ENV !== 'production' ) {
154
+ console . warn ( `[vuex] error in after action subscribers: ` )
155
+ console . error ( e )
156
+ }
157
+ }
158
+ return res
159
+ } )
145
160
}
146
161
147
162
subscribe ( fn ) {
You can’t perform that action at this time.
0 commit comments