Decode all strerror-based exception messages
I reviewed all instances of: - EnvironmentError - OSError - IOError - socket.error In most cases, we already used encoding.locale_decode(). The case fixed in mopidy/utils/network.py fixes #971. The case fixed in mopidy/utils/path.py might be triggered during a local library scan.
This commit is contained in:
parent
3559e61d75
commit
4972d1da57
@ -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):
|
||||
|
||||
@ -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()
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user