Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[deploy] Improve error message when the internet connection is down #55

Open
alliblk opened this issue Sep 26, 2019 · 0 comments
Open
Labels
papercut Something that works but could be better

Comments

@alliblk
Copy link

alliblk commented Sep 26, 2019

I know most of us use Nextstrain with awesome internet, but as the CLI facilitates uptake, and hopefully in places with shoddier internet, we’ll get some errors thrown that are common and should have nice error messages, rather than just the goto exceptions.

For instance, when I runnextstrain deploy but the internet mucks up and it can’t connect to the S3 bucket, I get really ugly standard error output (posted below). This output would probably be concerning to someone who is less familiar with the command line. Given that internet connectivity issues are reasonably common, it seems like a decent thing to make this scenario spit out an informative and shorter error message of our choice, rather than this default blurb.

>>> Traceback (most recent call last):
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/urllib3/connection.py", line 160, in _new_conn
    (self._dns_host, self.port), self.timeout, **extra_kw)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/urllib3/util/connection.py", line 80, in create_connection
    raise err
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/urllib3/util/connection.py", line 70, in create_connection
    sock.connect(sa)
ConnectionRefusedError: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/httpsession.py", line 262, in send
    chunked=self._chunked(request.headers),
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/urllib3/connectionpool.py", line 641, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/urllib3/util/retry.py", line 344, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/urllib3/connectionpool.py", line 603, in urlopen
    chunked=chunked)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/urllib3/connectionpool.py", line 344, in _make_request
    self._validate_conn(conn)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/urllib3/connectionpool.py", line 843, in _validate_conn
    conn.connect()
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/urllib3/connection.py", line 316, in connect
    conn = self._new_conn()
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/urllib3/connection.py", line 169, in _new_conn
    self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <botocore.awsrequest.AWSHTTPSConnection object at 0x10690da58>: Failed to establish a new connection: [Errno 61] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/alliblk/miniconda3/envs/nextstrain/bin/nextstrain", line 10, in <module>
    sys.exit(main())
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/nextstrain/cli/__main__.py", line 10, in main
    return cli.run( argv[1:] )
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/nextstrain/cli/__init__.py", line 51, in run
    return opts.__command__.run(opts)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/nextstrain/cli/command/deploy.py", line 87, in run
    return deploy.run(url, files)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/nextstrain/cli/deploy/s3.py", line 45, in run
    boto3.client("s3").head_bucket(Bucket = bucket.name)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/client.py", line 357, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/client.py", line 648, in _make_api_call
    operation_model, request_dict, request_context)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/client.py", line 667, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/endpoint.py", line 102, in make_request
    return self._send_request(request_dict, operation_model)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/endpoint.py", line 137, in _send_request
    success_response, exception):
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/endpoint.py", line 231, in _needs_retry
    caught_exception=caught_exception, request_dict=request_dict)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/retryhandler.py", line 183, in __call__
    if self._checker(attempts, response, caught_exception):
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/retryhandler.py", line 251, in __call__
    caught_exception)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/retryhandler.py", line 277, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/retryhandler.py", line 317, in __call__
    caught_exception)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/retryhandler.py", line 223, in __call__
    attempt_number, caught_exception)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/endpoint.py", line 200, in _do_get_response
    http_response = self._send(request)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/endpoint.py", line 244, in _send
    return self.http_session.send(request)
  File "/Users/alliblk/miniconda3/envs/nextstrain/lib/python3.6/site-packages/botocore/httpsession.py", line 282, in send
    raise EndpointConnectionError(endpoint_url=request.url, error=e)
botocore.exceptions.EndpointConnectionError: Could not connect to the endpoint URL: "https://nextstrain-inrb.s3.amazonaws.com/"
@alliblk alliblk added enhancement New feature or request priority: low To be resolved after high and moderate priority issues labels Sep 26, 2019
@tsibley tsibley changed the title improve nextstrain deploy error message when internet connection is down [deploy] Improve error message when the internet connection is down Oct 3, 2019
@tsibley tsibley added papercut Something that works but could be better and removed enhancement New feature or request priority: low To be resolved after high and moderate priority issues labels Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
papercut Something that works but could be better
Projects
None yet
Development

No branches or pull requests

2 participants