diff --git a/js/components/ascribe_uploader/react_s3_fine_uploader.js b/js/components/ascribe_uploader/react_s3_fine_uploader.js index b11a877f..19705925 100644 --- a/js/components/ascribe_uploader/react_s3_fine_uploader.js +++ b/js/components/ascribe_uploader/react_s3_fine_uploader.js @@ -479,8 +479,12 @@ const ReactS3FineUploader = React.createClass({ } else { matchedErrorClass = testErrorAgainstAll({ type, reason, xhr }); - // If none found, show the next error message - if (!matchedErrorClass) { + // If none found, check the internet connection + // TODO: use a better mechanism for checking network state, ie. offline.js + if ('onLine' in window.navigator && !window.navigator.onLine) { + matchedErrorClass = ErrorClasses.upload.offline; + } else { + // Otherwise, show the next error message in the queue matchedErrorClass = ErrorQueueStore.getNextError('upload'); } } diff --git a/js/constants/error_constants.js b/js/constants/error_constants.js index 19e06c18..d649e551 100644 --- a/js/constants/error_constants.js +++ b/js/constants/error_constants.js @@ -121,6 +121,9 @@ const ErrorClasses = { }, 'contactUs': { 'prettifiedText': getLangText("We're having a really hard time with your upload. Please contact us for more help.") + }, + 'offline': { + 'prettifiedText': getLangText('It looks like your Internet connection might have gone down during the upload. Please check your connection and try again.') } }, 'default': {