Merge pull request #611 from lbryio/lbrynet-response-handler

fix error messages
This commit is contained in:
Travis Eden 2018-10-05 09:37:09 -04:00 committed by GitHub
commit b5c7aa9a02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View file

@ -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) &&
<div>
<p>Unfortunately, we couldn't download your asset from LBRY. You can help us out by sharing the below error message in the <a className='link--primary' href='https://chat.lbry.io' target='_blank'>LBRY discord</a>.</p>
<i><p id='error-message'>{error}</p></i>
<Row>
<p>Unfortunately, we couldn't download your asset from LBRY. You can help us out by sharing the following error message in the <a className='link--primary' href='https://chat.lbry.io' target='_blank'>LBRY discord</a>.</p>
</Row>
<Row>
<p id='error-message'><i>{error}</i></p>
</Row>
</div>
}
{(status === AVAILABLE) &&

View file

@ -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;
}