diff --git a/src/composer/cli/__init__.py b/src/composer/cli/__init__.py index e4850af8..97c7a9fc 100644 --- a/src/composer/cli/__init__.py +++ b/src/composer/cli/__init__.py @@ -49,4 +49,8 @@ def main(opts): log.error("Missing %s sub-command", opts.args[0]) return 1 else: - return command_map[opts.args[0]](opts) + try: + return command_map[opts.args[0]](opts) + except Exception as e: + log.error(str(e)) + return 1 diff --git a/src/composer/http_client.py b/src/composer/http_client.py index 658bf0bb..1b3ea586 100644 --- a/src/composer/http_client.py +++ b/src/composer/http_client.py @@ -158,6 +158,10 @@ def download_file(socket_path, url, progress=True): """ http = UnixHTTPConnectionPool(socket_path) r = http.request("GET", url, preload_content=False) + if r.status == 400: + err = json.loads(r.data.decode("utf-8")) + if not err["status"]: + raise RuntimeError(err["error"]["msg"]) filename = get_filename(r) if os.path.exists(filename):