File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -247,11 +247,16 @@ class Reactor {
247
247
248
248
// let each core handle the message
249
249
this . __stores . forEach ( ( store , id ) => {
250
- var currState = state . get ( id )
251
- var newState = store . handle ( currState , actionType , payload )
252
-
253
- if ( this . debug && newState === undefined ) {
254
- var error = 'Store handler must return a value, did you forget a return statement'
250
+ var currState = state . get ( id ) , newState , dispatchError
251
+
252
+ try {
253
+ newState = store . handle ( currState , actionType , payload )
254
+ } catch ( e ) {
255
+ dispatchError = e
256
+ }
257
+
258
+ if ( this . debug && ( newState === undefined || dispatchError ) ) {
259
+ var error = dispatchError || 'Store handler must return a value, did you forget a return statement'
255
260
logging . dispatchError ( error )
256
261
throw new Error ( error )
257
262
}
You can’t perform that action at this time.
0 commit comments