D5772: hg: raise Abort on invalid path
Yuya Nishihara
yuya at tcha.org
Thu Jan 31 07:53:49 EST 2019
> + try:
> + isfile = os.path.isfile(path)
> + # Python 2 raises TypeError, Python 3 ValueError.
> + except (TypeError, ValueError) as e:
> + raise error.Abort(_('invalid path %s: %s') % (
> + path, pycompat.bytestr(e)))
I don't know if the path is included in the exception message, but it's
probably safer to use `stringutil.forcebytestr(e)` to get around possible
UnicodeError.
More information about the Mercurial-devel
mailing list