Upgrade from 3.x to 4.0.0
// before
const bar = () => ({
type: 'FOO',
payload: new Promise(() => {
reject('foo');
})
});.then(() => null, ({ reason, action }) => {
console.log(action.type): // => 'FOO'
console.log(reason.message); // => 'foo'
});
// after
const bar = () => ({
type: 'FOO',
payload: new Promise(() => {
/**
* Make sure the promise is rejected with an error. You
* can also use `reject(new Error('foo'));`. It's a best
* practice to reject a promise with an Error object.
*/
throw new Error('foo');
})
});.then(() => null, error => {
console.log(error instanceof Error); // => true
console.log(error.message); // => 'foo'
});2.x to 3.0.0
Last updated