upip: Report package not found and similar errors with less noise.

While still allow to get full backtrace with --debug.
pull/158/head
Paul Sokolovsky 2017-02-08 00:39:47 +03:00
rodzic f6668aae28
commit 068988085e
1 zmienionych plików z 8 dodań i 5 usunięć

Wyświetl plik

@ -124,13 +124,14 @@ def url_open(url):
l = s.readline()
protover, status, msg = l.split(None, 2)
if status != b"200":
exc = ValueError(status)
if status == b"404":
print("Package not found")
raise ValueError(status)
fatal("Package not found", exc)
fatal("Unexpected error querying for package", exc)
while 1:
l = s.readline()
if not l:
raise ValueError("Unexpected EOF")
fatal("Unexpected EOF in HTTP headers", ValueError())
if l == b'\r\n':
break
@ -144,8 +145,10 @@ def get_pkg_metadata(name):
return json.loads(s)
def fatal(msg):
print(msg)
def fatal(msg, exc=None):
print("Error:", msg)
if exc and debug:
raise exc
sys.exit(1)
def install_pkg(pkg_spec, install_path):