File tree Expand file tree Collapse file tree 1 file changed +23
-8
lines changed
Expand file tree Collapse file tree 1 file changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -129,19 +129,34 @@ export class Store {
129129 return
130130 }
131131
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+ }
135142
136143 const result = entry . length > 1
137144 ? Promise . all ( entry . map ( handler => handler ( payload ) ) )
138145 : entry [ 0 ] ( payload )
139146
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+ } )
145160 }
146161
147162 subscribe ( fn ) {
You can’t perform that action at this time.
0 commit comments