redux-promise-listener icon indicating copy to clipboard operation
redux-promise-listener copied to clipboard

Uncaught (in promise) errors

Open zomars opened this issue 7 years ago • 1 comments

Are you submitting a bug report or a feature request?

This is a bug report.

What is the current behavior?

When a promise is rejected the error is not being caught.

What is the expected behavior?

The error being caught.

Sandbox Link

https://codesandbox.io/s/qqwn5vn1rj

What's your environment?

I'm using redux-promise-listener v1.1.0 and react-redux-promise-listener v1.0.0

Other information

I've described the issue here also.

zomars avatar Sep 20 '18 14:09 zomars

It's not very straightforward, but there is note somewhere stating the following:

Final Form expects submit errors to come back in a resolved promise.

Something like this worked for me:

    <MakeAsyncFunction
      listener={promiseListener}
      start="START_ACTION_TYPE" // the type of action to dispatch when this function is called
      resolve={({ type }) => type === RESOLVE_ACTION_TYPE || type === REJECT_ACTION_TYPE} // the type of action that will resolve the promise 
    >

As a side note, even if the prop type is string inreact-redux-promise-listener, redux-promise-listener can take an action matcher as well as a string.

lutangar avatar Nov 21 '18 14:11 lutangar