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

Handle ConnectionError before checking status_code #52

Closed
wants to merge 1 commit into from
Closed

Handle ConnectionError before checking status_code #52

wants to merge 1 commit into from

Conversation

arite
Copy link

@arite arite commented Apr 25, 2015

In the event of a ConnectionError, when checking err.response.status_code an Uncaught Exception is thrown as the request object doesn't exist.

This occurs when the network is not fully ready. In my case this happens when running Mopidy as a daemon on startup (on a Raspberry Pi 2).

Example error:

2015-04-25 18:56:51,341 ERROR [226:MainThread] mopidy.commands: Uncaught exception
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/mopidy/commands.py", line 274, in run
    backends = self.start_backends(config, backend_classes, audio)
  File "/usr/lib/python2.7/dist-packages/mopidy/commands.py", line 352, in start_backends
    config=config, audio=audio).proxy()
  File "/usr/lib/python2.7/dist-packages/pykka/actor.py", line 93, in start
    obj = cls(*args, **kwargs)
  File "/usr/share/mopidy/mopidy_soundcloud/actor.py", line 21, in __init__
    self.remote = SoundCloudClient(config['soundcloud'])
  File "/usr/share/mopidy/mopidy_soundcloud/soundcloud.py", line 80, in __init__
    if err.response.status_code == 401:
AttributeError: 'NoneType' object has no attribute 'status_code'

By handling this exception first it prevents Mobidy from exiting prematurely.

@arite arite changed the title Handle ConnectionError before checking status_code. Handle ConnectionError before checking status_code Apr 25, 2015
@jodal
Copy link
Member

jodal commented Nov 28, 2015

Fixed by #61.

@jodal jodal closed this Nov 28, 2015
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

Successfully merging this pull request may close these issues.

2 participants