diff --git a/src/lib/RepStatus.js b/src/lib/RepStatus.js index 1315c0044..f2ee731ec 100644 --- a/src/lib/RepStatus.js +++ b/src/lib/RepStatus.js @@ -134,6 +134,9 @@ class RepStatus extends EventEmitter { case ERROR_CODE.CONVERSION_UNSUPPORTED_FORMAT: errorMessage = __('error_bad_file'); break; + case ERROR_CODE.CONVERSION_FAILED: + errorMessage = __('error_reupload'); + break; default: errorMessage = __('error_refresh'); break; diff --git a/src/lib/__tests__/RepStatus-test.js b/src/lib/__tests__/RepStatus-test.js index 9fd2689f8..1a84ecfb4 100644 --- a/src/lib/__tests__/RepStatus-test.js +++ b/src/lib/__tests__/RepStatus-test.js @@ -226,6 +226,20 @@ describe('lib/RepStatus', () => { repStatus.handleResponse(); }); + it('should reject with the re upload message if the rep status is error due to conversion failure', done => { + sandbox + .mock(repStatus) + .expects('reject') + .callsFake(err => { + expect(err.displayMessage).to.equal(__('error_reupload')); + done(); + }); + repStatus.representation.status.state = 'error'; + repStatus.representation.status.code = 'error_conversion_failed'; + + repStatus.handleResponse(); + }); + it('should resolve if the rep status is success', () => { sandbox.mock(repStatus).expects('resolve'); repStatus.representation.status.state = 'success'; diff --git a/src/lib/events.js b/src/lib/events.js index cfcd9624e..713c89ad1 100644 --- a/src/lib/events.js +++ b/src/lib/events.js @@ -22,6 +22,7 @@ export const ERROR_CODE = { BROWSER_GENERIC: 'error_browser_generic', BROWSER_UNSUPPORTED: 'error_browser_unsupported', CONTENT_DOWNLOAD: 'error_content_download', + CONVERSION_FAILED: 'error_conversion_failed', CONVERSION_GENERIC: 'error_conversion_generic', CONVERSION_PASSWORD_PROTECTED: 'error_password_protected', CONVERSION_TRY_AGAIN_LATER: 'error_try_again_later',