Skip to content

Commit

Permalink
Merge pull request pypa#9315 from pradyunsg/better-search-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed Jan 23, 2021
1 parent ae52918 commit e4edf1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions news/9315.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve presentation of XMLRPC errors in pip search.
9 changes: 8 additions & 1 deletion src/pip/_internal/commands/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@ def search(self, query, options):

transport = PipXmlrpcTransport(index_url, session)
pypi = xmlrpc_client.ServerProxy(index_url, transport)
hits = pypi.search({'name': query, 'summary': query}, 'or')
try:
hits = pypi.search({'name': query, 'summary': query}, 'or')
except xmlrpc_client.Fault as fault:
message = "XMLRPC request failed [code: {code}]\n{string}".format(
code=fault.faultCode,
string=fault.faultString,
)
raise CommandError(message)
return hits


Expand Down

0 comments on commit e4edf1f

Please sign in to comment.