Nekmo / amazon-dash

Hack your Amazon Dash to run what you want.
MIT License
829 stars 67 forks source link

error message insted of traceback #164

Closed florie1706 closed 2 years ago

florie1706 commented 4 years ago

Put an x into all the boxes [ ] relevant to your issue (like this: [x])

What is the purpose of your issue?

Description

My device which I control thru amazon-dash was not connected to my Wifi (my fault). But is it possible to have a "short" error message instead of this full traceback?

What I Did

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner

self.run()

File "/usr/local/lib/python3.8/threading.py", line 870, in run

self._target(*self._args, **self._kwargs)

File "/usr/local/lib/python3.8/site-packages/amazon_dash/listener.py", line 84, in execute

result = self.execute_instance.execute(root_allowed)

File "/usr/local/lib/python3.8/site-packages/amazon_dash/execute.py", line 220, in execute

raise ExecuteError('Exception on request to {}: {}'.format(self.data['url'], e))

amazon_dash.exceptions.ExecuteError: Exception on request to http://USER:PASSWORD@192.168.33.1/relay/0?turn=on: HTTPConnectionPool(host='192.168.33.1', port=80): Max retries exceeded with url: /relay/0?turn=on (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fce9b665ca0>: Failed to establish a new connection: [Errno 113] Host is unreachable'))

Nekmo commented 4 years ago

Hi @florie1706 ,

It is a good idea and easy to implement, I will add it to the next release.

Thanks :)

Nekmo commented 2 years ago

New error message:

Error executing the device <device_name>: Exception on request to http://xxx.xxx.xx.xx/: Connection to xxx.xxx.xx.xx timed out. (connect timeout=15)