Catch connection errors and improve error messages
まだ誰も着手していません。
評価
調査の方向性
まず datadelivery/commands.py と datadelivery/s3.py の deliver フローを追跡し、特に _get_current_endpoint と _get_request を確認してから、利用できない API URL を使ってコマンドを再現します。HTTP 接続エラーが完全なトレースバックではなく、簡潔でユーザー向けのエラーとして報告されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I had a stale configuration my ~/.datadelivery.yml file, pointing to a URL that's not live:
url: http://127.0.0.1:8000/api/v2/
When I tried to run a deliver command, I get the following:
$ datadelivery deliver -b sample --email [email protected]
Traceback (most recent call last):
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connection.py", line 141, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/util/connection.py", line 83, in create_connection
raise err
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/util/connection.py", line 73, 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/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connectionpool.py", line 601, in urlopen
chunked=chunked)
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connectionpool.py", line 357, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1239, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1285, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1234, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 1026, in _send_output
self.send(msg)
File "/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/http/client.py", line 964, in send
self.connect()
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connection.py", line 166, in connect
conn = self._new_conn()
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connection.py", line 150, in _new_conn
self, "Failed to establish a new connection: %s" % e)
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPConnection object at 0x10af6c908>: 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/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/adapters.py", line 440, in send
timeout=timeout
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/connectionpool.py", line 639, in urlopen
_stacktrace=sys.exc_info()[2])
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/urllib3-1.22-py3.6.egg/urllib3/util/retry.py", line 388, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='127.0.0.1', port=8000): Max retries exceeded with url: /api/v2/s3-endpoints/?name=default (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10af6c908>: 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/dcl9/Code/python/datadelivery-cli/venv/bin/datadelivery", line 11, in <module>
load_entry_point('datadelivery==0.0.1', 'console_scripts', 'datadelivery')()
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/__main__.py", line 14, in main
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/argparser.py", line 26, in parse_and_run_commands
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/argparser.py", line 73, in _run_deliver
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/commands.py", line 24, in deliver
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/commands.py", line 14, in _create_s3
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/s3.py", line 11, in __init__
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/s3.py", line 62, in _get_current_endpoint
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/datadelivery-0.0.1-py3.6.egg/datadelivery/s3.py", line 27, in _get_request
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/api.py", line 72, in get
return request('get', url, params=params, **kwargs)
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/Users/dcl9/Code/python/datadelivery-cli/venv/lib/python3.6/site-packages/requests-2.18.4-py3.6.egg/requests/adapters.py", line 508, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=8000): Max retries exceeded with url: /api/v2/s3-endpoints/?name=default (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x10af6c908>: Failed to establish a new connection: [Errno 61] Connection refused',))
$
While we don't expect end-users to override their API url here, HTTP connection errors should be expected and relayed more succintcly :)
- 主要言語
- Python
- スター
- 0
- フォーク
- 0
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Duke-GCB/datadelivery-cli のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
Duke-GCB/datadelivery-cli#4 · コメント 2 件 ·
Duke-GCB/datadelivery-cli の issue をすべて見る
似ている issue
-
docs(types): update the collection binding note now that typed collections shipped in pycubrid 1.9.0オープンdocumentation priority: low size: S
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
cubrid-lab/sqlalchemy-cubrid#768 ·
メンテナーはふだん 1 日以内に返信
-
bug help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
ansys/pydpf-core#3547 ·
メンテナーはふだん 1 日以内に返信
-
core
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
vectorize-io/hindsight#5457 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: LangChain drops OpenAI Responses text blocks from session recording対応中かも @ktz03 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
volcengine/OpenViking#5806 ·
メンテナーはふだん 1 日以内に返信