From 77fa5dfb9ec2c48e7d6396210a77dd7efaa96856 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Fri, 18 Dec 2020 17:48:38 +0000 Subject: [PATCH 1/2] Present a nicer error in pip search --- src/pip/_internal/commands/search.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pip/_internal/commands/search.py b/src/pip/_internal/commands/search.py index 146d653e55f..185495e7688 100644 --- a/src/pip/_internal/commands/search.py +++ b/src/pip/_internal/commands/search.py @@ -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 From e6d2bb234158f5c37d18999870ddda18b64e0a64 Mon Sep 17 00:00:00 2001 From: Pradyun Gedam Date: Mon, 21 Dec 2020 19:10:19 +0000 Subject: [PATCH 2/2] :newspaper: --- news/9315.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/9315.feature.rst diff --git a/news/9315.feature.rst b/news/9315.feature.rst new file mode 100644 index 00000000000..64d1f25338b --- /dev/null +++ b/news/9315.feature.rst @@ -0,0 +1 @@ +Improve presentation of XMLRPC errors in pip search.