Skip to content

Commit 7e609a0

Browse files
authored
Merge pull request #9315 from pradyunsg/better-search-errors
2 parents 2aea6e8 + e6d2bb2 commit 7e609a0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

Diff for: news/9315.feature.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Improve presentation of XMLRPC errors in pip search.

Diff for: src/pip/_internal/commands/search.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ def search(self, query, options):
7777

7878
transport = PipXmlrpcTransport(index_url, session)
7979
pypi = xmlrpc_client.ServerProxy(index_url, transport)
80-
hits = pypi.search({'name': query, 'summary': query}, 'or')
80+
try:
81+
hits = pypi.search({'name': query, 'summary': query}, 'or')
82+
except xmlrpc_client.Fault as fault:
83+
message = "XMLRPC request failed [code: {code}]\n{string}".format(
84+
code=fault.faultCode,
85+
string=fault.faultString,
86+
)
87+
raise CommandError(message)
8188
return hits
8289

8390

0 commit comments

Comments
 (0)