Merge pull request #1044 from jodal/fix/971-decode-strerror

Decode all strerror-based exception messages
This commit is contained in:
Thomas Adamcik 2015-03-17 22:29:34 +01:00
commit 6273247c6e
3 changed files with 9 additions and 2 deletions

View File

@ -144,6 +144,10 @@ v0.20.0 (UNRELEASED)
- Start setting the ``Name`` field with the stream title when listening to
radio streams. (Fixes: :issue:`944`, PR: :issue:`1030`)
- Fix crash on socket error when using a locale causing the exception's error
message to contain characters not in ASCII. (Fixes: issue:`971`, PR:
:issue:`1044`)
**HTTP frontend**
- **Deprecated:** Deprecated the :confval:`http/static_dir` config. Please make

View File

@ -199,7 +199,8 @@ class Connection(object):
except socket.error as e:
if e.errno in (errno.EWOULDBLOCK, errno.EINTR):
return data
self.stop('Unexpected client error: %s' % e)
self.stop(
'Unexpected client error: %s' % encoding.locale_decode(e))
return b''
def enable_timeout(self):

View File

@ -12,6 +12,7 @@ import glib
from mopidy import compat, exceptions
from mopidy.compat import queue
from mopidy.utils import encoding
logger = logging.getLogger(__name__)
@ -157,7 +158,8 @@ def _find_worker(relative, follow, done, work, results, errors):
errors[path] = exceptions.FindError('Not a file or directory.')
except OSError as e:
errors[path] = exceptions.FindError(e.strerror, e.errno)
errors[path] = exceptions.FindError(
encoding.locale_decode(e.strerror), e.errno)
finally:
work.task_done()