Skip to content

Commit 9320491

Browse files
fix(overmind): fix catching errors in dev
1 parent 010fb86 commit 9320491

File tree

1 file changed

+7
-5
lines changed
  • packages/node_modules/overmind/src

1 file changed

+7
-5
lines changed

packages/node_modules/overmind/src/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ import {
5656
createActionsProxy,
5757
deepCopy,
5858
getActionPaths,
59+
getChangeMutations,
5960
getFunctionName,
6061
isPromise,
61-
processState,
62-
getChangeMutations
62+
processState
6363
} from './utils'
6464

6565
export * from './types'
@@ -603,12 +603,12 @@ export class Overmind<ThisConfig extends IConfiguration>
603603
const context = this.createContext(execution, mutationTree)
604604

605605
try {
606-
const result = action(context, scopedValue)
606+
let result = action(context, scopedValue)
607607

608608
if (isPromise(result)) {
609609
this.eventHub.emit(EventType.OPERATOR_ASYNC, execution)
610-
result
611-
.then(() => {
610+
result = result
611+
.then((promiseResult) => {
612612
execution.isRunning = false
613613
if (!boundExecution) {
614614
mutationTree.dispose()
@@ -619,6 +619,8 @@ export class Overmind<ThisConfig extends IConfiguration>
619619
result: undefined,
620620
})
621621
this.eventHub.emit(EventType.ACTION_END, execution)
622+
623+
return promiseResult
622624
})
623625
.catch((error) => {
624626
execution.isRunning = false

0 commit comments

Comments
 (0)