Skip to content

Commit

Permalink
Update handling of failure in RSAA descriptor custom methods
Browse files Browse the repository at this point in the history
This is a follow-up to #175, which updated this behavior and docs
for failed fetches, to include failures in RSAA custom methods,
such as `[RSAA].headers`
  • Loading branch information
nason committed Jul 16, 2018
1 parent c424041 commit f0ca6fb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 35 deletions.
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

0 comments on commit f0ca6fb

Please sign in to comment.