fix format of resolve on inexistent URI

This commit is contained in:
Victor Shyba 2018-09-27 01:56:04 -03:00 committed by Lex Berezhny
parent 0fb6f50aba
commit e1130147b5
2 changed files with 8 additions and 1 deletions

View file

@ -36,7 +36,9 @@ class Resolver:
(yield self._handle_resolve_uri_response(uri, resolution, page, page_size))
)
except (UnknownNameError, UnknownClaimID, UnknownURI) as err:
results[uri] = {'error': err.message}
results[uri] = {'error': str(err)}
else:
results[uri] = {'error': "URI lbry://{} cannot be resolved".format(uri.replace("lbry://", ""))}
defer.returnValue(results)
@defer.inlineCallbacks

View file

@ -89,3 +89,8 @@ class BasicTransactionTest(IntegrationTestCase):
response = await d2f(self.ledger.resolve(0, 10, 'lbry://@bar/foo'))
self.assertNotIn('claim', response['lbry://@bar/foo'])
# checks for expected format in inexistent URIs
response = await d2f(self.ledger.resolve(0, 10, 'lbry://404', 'lbry://@404'))
self.assertEqual('URI lbry://404 cannot be resolved', response['lbry://404']['error'])
self.assertEqual('URI lbry://@404 cannot be resolved', response['lbry://@404']['error'])