From 63f8bbc6757c6885dc42d715f3f5a8250b20dd76 Mon Sep 17 00:00:00 2001 From: Jessie Keck <jessie.keck@gmail.com> Date: Tue, 19 Feb 2019 15:05:06 -0800 Subject: [PATCH] Handle object type errors being returned from fetchManifest (by casting to a string). --- src/state/actions/manifest.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/state/actions/manifest.js b/src/state/actions/manifest.js index beda211f0..a26e89981 100644 --- a/src/state/actions/manifest.js +++ b/src/state/actions/manifest.js @@ -58,7 +58,13 @@ export function fetchManifest(manifestId, properties) { return fetch(manifestId) .then(response => response.json()) .then(json => dispatch(receiveManifest(manifestId, json))) - .catch(error => dispatch(receiveManifestFailure(manifestId, error))); + .catch((error) => { + if (typeof error === 'object') { // Returned by JSON parse failure + dispatch(receiveManifestFailure(manifestId, String(error))); + } else { + dispatch(receiveManifestFailure(manifestId, error)); + } + }); }); } -- GitLab