Skip to content

Commit

Permalink
Merge pull request #9315 from pradyunsg/better-search-errors
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg authored Dec 27, 2020
2 parents 2aea6e8 + e6d2bb2 commit 7e609a0
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 @@ -77,7 +77,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 7e609a0

Please sign in to comment.