improvement: add logs when a 404 error is expected (#2807)

improvement: add logs when a 404 error is expected

improvement: address code review feedback -return rejected promise
This commit is contained in:
ed ho
2019-11-10 00:34:03 -08:00
committed by Erez Rokah
parent 542a7acfe6
commit 1d78a2705f
4 changed files with 32 additions and 4 deletions

View File

@ -148,7 +148,14 @@ export function loadMedia(opts = {}) {
.catch(
error =>
console.error(error) ||
dispatch(error.status === 404 ? mediaLoaded() : mediaLoadFailed()),
dispatch(() => {
if (error.status === 404) {
console.log('This 404 was expected and handled appropriately.');
return mediaLoaded();
} else {
return mediaLoadFailed();
}
}),
),
),
);