Commit 806d14efec8 by Gregory Szorc

fsmonitor: properly handle str ex.msg

ex.msg is always a str, since pywatchman uses str for exception messages.

This commit removes a b'' from a string compare to avoid types
mismatch and adds a coercion to bytes before stuffing the exception
message on our local exception type, which uses bytes for the message
elsewhere in this file.

Differential Revision:
parent b9e174d4ed1
......@@ -105,11 +105,11 @@ class client(object):
return self._watchmanclient.query(*watchmanargs)
except pywatchman.CommandError as ex:
if b'unable to resolve root' in ex.msg:
if 'unable to resolve root' in ex.msg:
raise WatchmanNoRoot(
self._root, stringutil.forcebytestr(ex.msg)
raise Unavailable(ex.msg)
raise Unavailable(stringutil.forcebytestr(ex.msg))
except pywatchman.WatchmanError as ex:
raise Unavailable(stringutil.forcebytestr(ex))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment