ExecContext: Map ENOTDIR to FileNotFoundError #133
1 changed files with 2 additions and 0 deletions
|
|
@ -37,6 +37,8 @@ def _raise_stat_error(path: str, result: Result) -> None:
|
||||||
lower = msg.lower()
|
lower = msg.lower()
|
||||||
if 'no such file' in lower:
|
if 'no such file' in lower:
|
||||||
raise FileNotFoundError(errno.ENOENT, msg, path)
|
raise FileNotFoundError(errno.ENOENT, msg, path)
|
||||||
|
if 'not a directory' in lower:
|
||||||
|
raise FileNotFoundError(errno.ENOTDIR, msg, path)
|
||||||
if 'permission denied' in lower or 'operation not permitted' in lower:
|
if 'permission denied' in lower or 'operation not permitted' in lower:
|
||||||
raise PermissionError(errno.EACCES, msg, path)
|
raise PermissionError(errno.EACCES, msg, path)
|
||||||
raise OSError(errno.EIO, msg, path)
|
raise OSError(errno.EIO, msg, path)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue