Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update handling of failure in RSAA descriptor custom methods #206

Merged
merged 1 commit into from
Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 30 additions & 30 deletions src/__snapshots__/middleware.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -864,9 +864,9 @@ exports[`#apiMiddleware must dispatch an error request FSA for an invalid RSAA w
exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].bailout fails: final result 1`] = `
Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].bailout function failed],
"type": "REQUEST",
"type": "FAILURE",
}
`;

Expand All @@ -876,9 +876,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].bailout f
Array [
Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].bailout function failed],
"type": "REQUEST",
"type": "FAILURE",
},
],
],
Expand All @@ -887,9 +887,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].bailout f
"isThrow": false,
"value": Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].bailout function failed],
"type": "REQUEST",
"type": "FAILURE",
},
},
],
Expand All @@ -899,9 +899,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].bailout f
exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].body fails: final result 1`] = `
Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].body function failed],
"type": "REQUEST",
"type": "FAILURE",
}
`;

Expand All @@ -911,9 +911,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].body fail
Array [
Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].body function failed],
"type": "REQUEST",
"type": "FAILURE",
},
],
],
Expand All @@ -922,9 +922,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].body fail
"isThrow": false,
"value": Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].body function failed],
"type": "REQUEST",
"type": "FAILURE",
},
},
],
Expand All @@ -934,9 +934,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].body fail
exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].endpoint fails: final result 1`] = `
Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].endpoint function failed],
"type": "REQUEST",
"type": "FAILURE",
}
`;

Expand All @@ -946,9 +946,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].endpoint
Array [
Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].endpoint function failed],
"type": "REQUEST",
"type": "FAILURE",
},
],
],
Expand All @@ -957,9 +957,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].endpoint
"isThrow": false,
"value": Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].endpoint function failed],
"type": "REQUEST",
"type": "FAILURE",
},
},
],
Expand All @@ -969,9 +969,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].endpoint
exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].headers fails: final result 1`] = `
Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].headers function failed],
"type": "REQUEST",
"type": "FAILURE",
}
`;

Expand All @@ -981,9 +981,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].headers f
Array [
Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].headers function failed],
"type": "REQUEST",
"type": "FAILURE",
},
],
],
Expand All @@ -992,9 +992,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].headers f
"isThrow": false,
"value": Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].headers function failed],
"type": "REQUEST",
"type": "FAILURE",
},
},
],
Expand Down Expand Up @@ -1076,9 +1076,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].ok fails:
exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].options fails: final result 1`] = `
Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].options function failed],
"type": "REQUEST",
"type": "FAILURE",
}
`;

Expand All @@ -1088,9 +1088,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].options f
Array [
Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].options function failed],
"type": "REQUEST",
"type": "FAILURE",
},
],
],
Expand All @@ -1099,9 +1099,9 @@ exports[`#apiMiddleware must dispatch an error request FSA when [RSAA].options f
"isThrow": false,
"value": Object {
"error": true,
"meta": "someMeta",
"meta": undefined,
"payload": [RequestError: [RSAA].options function failed],
"type": "REQUEST",
"type": "FAILURE",
},
},
],
Expand Down
10 changes: 5 additions & 5 deletions src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function createMiddleware(options = {}) {
return next(
await actionWith(
{
...requestType,
...failureType,
payload: new RequestError('[RSAA].bailout function failed'),
error: true
},
Expand All @@ -93,7 +93,7 @@ function createMiddleware(options = {}) {
return next(
await actionWith(
{
...requestType,
...failureType,
payload: new RequestError('[RSAA].endpoint function failed'),
error: true
},
Expand All @@ -111,7 +111,7 @@ function createMiddleware(options = {}) {
return next(
await actionWith(
{
...requestType,
...failureType,
payload: new RequestError('[RSAA].body function failed'),
error: true
},
Expand All @@ -129,7 +129,7 @@ function createMiddleware(options = {}) {
return next(
await actionWith(
{
...requestType,
...failureType,
payload: new RequestError('[RSAA].headers function failed'),
error: true
},
Expand All @@ -147,7 +147,7 @@ function createMiddleware(options = {}) {
return next(
await actionWith(
{
...requestType,
...failureType,
payload: new RequestError('[RSAA].options function failed'),
error: true
},
Expand Down