From e5132f19c3bd85abcfd6770f6251b3bb023f45a4 Mon Sep 17 00:00:00 2001 From: Travis Eden Date: Thu, 27 Sep 2018 18:12:17 -0400 Subject: [PATCH] use proper error checks; return only error message --- client/src/containers/AssetDisplay/view.jsx | 9 +++++++-- server/lbrynet/utils/handleLbrynetResponse.js | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/client/src/containers/AssetDisplay/view.jsx b/client/src/containers/AssetDisplay/view.jsx index e07bfa78..d5b37b82 100644 --- a/client/src/containers/AssetDisplay/view.jsx +++ b/client/src/containers/AssetDisplay/view.jsx @@ -1,4 +1,5 @@ import React from 'react'; +import Row from '@components/Row'; import ProgressBar from '@components/ProgressBar'; import { LOCAL_CHECK, UNAVAILABLE, ERROR, AVAILABLE } from '../../constants/asset_display_states'; @@ -26,8 +27,12 @@ class AssetDisplay extends React.Component { } {(status === ERROR) &&
-

Unfortunately, we couldn't download your asset from LBRY. You can help us out by sharing the below error message in the LBRY discord.

-

{error}

+ +

Unfortunately, we couldn't download your asset from LBRY. You can help us out by sharing the following error message in the LBRY discord.

+
+ +

{error}

+
} {(status === AVAILABLE) && diff --git a/server/lbrynet/utils/handleLbrynetResponse.js b/server/lbrynet/utils/handleLbrynetResponse.js index 8c430047..a5cc72a4 100644 --- a/server/lbrynet/utils/handleLbrynetResponse.js +++ b/server/lbrynet/utils/handleLbrynetResponse.js @@ -2,13 +2,13 @@ const logger = require('winston'); const handleLbrynetResponse = ({ data }, resolve, reject) => { logger.debug('lbry api data:', data); - if (data.result) { + if (data) { // check for an error - if (data.result.error) { - logger.debug('Lbrynet api error:', data.result.error); - reject(new Error(data.result.error)); + if (data.error) { + logger.debug('Lbrynet api error:', data.error); + reject(new Error(data.error.message)); return; - }; + } resolve(data.result); return; }