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

Incorrect handling of connection errors #40

Open
samueldg opened this issue Oct 24, 2016 · 1 comment
Open

Incorrect handling of connection errors #40

samueldg opened this issue Oct 24, 2016 · 1 comment

Comments

@samueldg
Copy link
Contributor

Looks like connection error handler code throws an exception (at least in this version of the Redis client):

Traceback (most recent call last):
  File ".../snappass/venv/bin/snappass", line 9, in <module>
    load_entry_point('snappass', 'console_scripts', 'snappass')()
  File ".../snappass/snappass/main.py", line 40, in inner
    print('Failed to connect to redis! %s' % e.message)
AttributeError: 'ConnectionError' object has no attribute 'message'

And double-checking:

>>> from redis.exceptions import ConnectionError
>>> 'message' in dir(ConnectionError)
False

Using str(e) probably solves the issue, and I guess adding a test would make sense.

Relates to the changes in #24

@aadarsh-nagrath
Copy link

It seems error indicates that an AttributeError is raised because the 'ConnectionError' object has no 'message' attribute. So I think using str(e) instead of e.message is reasonable, as str(e) will convert the exception object to a string and include the error message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants