From 2526ca668844f70a06bb388562f25f23724a0afc Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Fri, 1 Feb 2019 03:23:34 -0500 Subject: [PATCH] fix: pass error message Pass the download error message from SDK and fix up new line formatting on modals. We aren't using the timeout modal, but leaving in because we should use a special one for download failures in the future. --- CHANGELOG.md | 1 + src/renderer/redux/actions/content.js | 8 +++++--- src/renderer/scss/component/_modal.scss | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c285b1643..c63f38111 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Flow errors ([#2213](https://github.com/lbryio/lbry-desktop/pull/2213)) - Video position on previously viewed files ([#2240](https://github.com/lbryio/lbry-desktop/pull/2240)) +- Pass download error details on modal ([#2255](https://github.com/lbryio/lbry-desktop/pull/2255)) ## [0.27.1] - 2018-01-22 diff --git a/src/renderer/redux/actions/content.js b/src/renderer/redux/actions/content.js index 072b4b258..ce897f52d 100644 --- a/src/renderer/redux/actions/content.js +++ b/src/renderer/redux/actions/content.js @@ -180,12 +180,13 @@ function handleLoadVideoError(uri, errorType = '') { data: { uri }, }); dispatch(doSetPlayingUri(null)); + // this is not working, but should be it's own separate modal in the future (https://github.com/lbryio/lbry-desktop/issues/892) if (errorType === 'timeout') { doOpenModal(MODALS.FILE_TIMEOUT, { uri }); } else { dispatch( doError( - `Failed to download ${uri}, please try again. If this problem persists, visit https://lbry.io/faq/support for support.` + `Failed to download ${uri}, please try again or see error details:\n${errorType}\n\nIf this problem persists, visit https://lbry.io/support for help. ` ) ); } @@ -204,6 +205,7 @@ export function doLoadVideo(uri, shouldRecordViewEvent) { Lbry.get({ uri }) .then(streamInfo => { + // need error code from SDK to capture properly const timeout = streamInfo === null || typeof streamInfo !== 'object' || streamInfo.error === 'Timeout'; @@ -221,8 +223,8 @@ export function doLoadVideo(uri, shouldRecordViewEvent) { } } }) - .catch(() => { - dispatch(handleLoadVideoError(uri)); + .catch(error => { + dispatch(handleLoadVideoError(uri, error)); }); }; } diff --git a/src/renderer/scss/component/_modal.scss b/src/renderer/scss/component/_modal.scss index a3e0559b0..49b60c69a 100644 --- a/src/renderer/scss/component/_modal.scss +++ b/src/renderer/scss/component/_modal.scss @@ -107,6 +107,7 @@ .error-modal { max-width: none; width: var(--modal-width); + white-space: pre-wrap; } .error-modal__error-list { @@ -120,4 +121,5 @@ color: $lbry-red-5; list-style: none; overflow-y: scroll; + white-space: pre-wrap; }