Closed willnorris closed 4 years ago
technically, this means we could also remove the syscall.ENOENT
case from inside of translateError
, since that is only ever called from statusFromError
. I think it could still be reasonable to leave it there, but happy to remove it if you'd like.
Up to you, if you want to remove the ENOENT case. Like you say, we should never hit it anymore. But I am going to guess that it’s not actually too much code or binary bloat, so it might be better to keep it around as a just in case backup? 🤷♀️
I’m fine either way.
yeah, I think probably leave it in. 👍 Given what the function is doing... mapping syscall error numbers to ssh error codes, it makes sense for it to have fuller coverage of different error numbers. That keeps it somewhat semantically independent of the statusFromError func.
Always use os.IsNotExist to identify any OS specific error types that represent missing files or directories. This resolves an issue on Windows where some system errors (ENOTDIR) were not being identified as 'not found' errors and mapped to sshFxNoSuchFile.
fixes #381