[GH-ISSUE #54] Better error messaging #42

Closed
opened 2026-02-25 20:32:23 +03:00 by kerem · 2 comments
Owner

Originally created by @jakubjedelsky on GitHub (Feb 26, 2014).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/54

Based on https://bugzilla.redhat.com/show_bug.cgi?id=1070266

When user try to upload a session onto server where asciinema's service doesn't run, one gets this ugly python output:

~ Asciicast recording finished.
~ Do you want to upload it? [Y/n] 
~ Uploading...
Traceback (most recent call last):
  File "/usr/bin/asciinema", line 9, in <module>
    load_entry_point('asciinema==0.9.8', 'console_scripts', 'asciinema')()
  File "/usr/lib/python2.7/site-packages/asciinema/__main__.py", line 7, in main
    get_command(sys.argv[1:], Config()).execute()
  File "/usr/lib/python2.7/site-packages/asciinema/commands/record.py", line 24, in execute
    self._upload_asciicast(asciicast)
  File "/usr/lib/python2.7/site-packages/asciinema/commands/record.py", line 46, in _upload_asciicast
    url = self.uploader.upload(self.api_url, self.api_token, asciicast)
  File "/usr/lib/python2.7/site-packages/asciinema/uploader.py", line 29, in upload
    headers=headers)
  File "/usr/lib/python2.7/site-packages/asciinema/requests_http_adapter.py", line 7, in post
    response = requests.post(url, data=fields, files=files, headers=headers)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 88, in post
    return request('post', url, data=data, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 335, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 438, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 327, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=3000): Max retries exceeded with url: /api/asciicasts (Caused by <class 'socket.error'>: [Errno 111] Connection refused)

Can be there any nice-looking error message about no possibility to connect/upload session to server instead?

Originally created by @jakubjedelsky on GitHub (Feb 26, 2014). Original GitHub issue: https://github.com/asciinema/asciinema/issues/54 Based on https://bugzilla.redhat.com/show_bug.cgi?id=1070266 When user try to upload a session onto server where asciinema's service doesn't run, one gets this ugly python output: ``` ~ Asciicast recording finished. ~ Do you want to upload it? [Y/n] ~ Uploading... Traceback (most recent call last): File "/usr/bin/asciinema", line 9, in <module> load_entry_point('asciinema==0.9.8', 'console_scripts', 'asciinema')() File "/usr/lib/python2.7/site-packages/asciinema/__main__.py", line 7, in main get_command(sys.argv[1:], Config()).execute() File "/usr/lib/python2.7/site-packages/asciinema/commands/record.py", line 24, in execute self._upload_asciicast(asciicast) File "/usr/lib/python2.7/site-packages/asciinema/commands/record.py", line 46, in _upload_asciicast url = self.uploader.upload(self.api_url, self.api_token, asciicast) File "/usr/lib/python2.7/site-packages/asciinema/uploader.py", line 29, in upload headers=headers) File "/usr/lib/python2.7/site-packages/asciinema/requests_http_adapter.py", line 7, in post response = requests.post(url, data=fields, files=files, headers=headers) File "/usr/lib/python2.7/site-packages/requests/api.py", line 88, in post return request('post', url, data=data, **kwargs) File "/usr/lib/python2.7/site-packages/requests/api.py", line 44, in request return session.request(method=method, url=url, **kwargs) File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 335, in request resp = self.send(prep, **send_kwargs) File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 438, in send r = adapter.send(request, **kwargs) File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 327, in send raise ConnectionError(e) requests.exceptions.ConnectionError: HTTPConnectionPool(host='localhost', port=3000): Max retries exceeded with url: /api/asciicasts (Caused by <class 'socket.error'>: [Errno 111] Connection refused) ``` Can be there any nice-looking error message about no possibility to connect/upload session to server instead?
kerem closed this issue 2026-02-25 20:32:23 +03:00
Author
Owner

@ku1ik commented on GitHub (Feb 26, 2014):

Good catch. This is easy to fix.

Btw, the plan for the cli is to make it record locally, to a local "repository". You will record, then you can replay it in the terminal (just to check if it looks good) and eventually "push" it to the website. This will prevent losing the recording in case of network errors or when the website is down. And in general will add a lot more flexibility. See more here: https://github.com/sickill/asciinema/pull/49

<!-- gh-comment-id:36138165 --> @ku1ik commented on GitHub (Feb 26, 2014): Good catch. This is easy to fix. Btw, the plan for the cli is to make it record locally, to a local "repository". You will record, then you can replay it in the terminal (just to check if it looks good) and eventually "push" it to the website. This will prevent losing the recording in case of network errors or when the website is down. And in general will add a lot more flexibility. See more here: https://github.com/sickill/asciinema/pull/49
Author
Owner

@ku1ik commented on GitHub (Dec 17, 2014):

0.9.9 has just been released. It was rewritten in Go so the error handling changed completely. Hopefully for the better :)

<!-- gh-comment-id:67402750 --> @ku1ik commented on GitHub (Dec 17, 2014): 0.9.9 has just been released. It was rewritten in Go so the error handling changed completely. Hopefully for the better :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/asciinema#42
No description provided.