Closed citreae535 closed 1 year ago
I'm not against this PR. But I also want to note that this crate is supposed to be a high level abstraction for Windows services, and a user of the library should preferably not need to deal with OS error codes or other windows-sys
stuff if possible.
Hmm, I reconsidered it and have to agree that most users won't need this change. Better close it then.
Currently we do not translate errors returned from syscalls into meaningful errors. Instead we return Winapi(io::Error)
variant so the one has to parse io::Error
to find the cause of error.
We could of course introduce new error types and provide error variants for common error codes but we would almost always have to have a Other(io::Error)
variant since we do not control Windows API. I am not quite sure that beefing up a single Error
type would be the way to go, on the other side having dedicated errors types would mean that we'd have to have duplicate error variants like those that we currently have in the Error
type.
Anyhow, reinventing that would be a big task.
This function checks if an error from win32 API call matches a specific OS error code. This makes it easier for users to check specific API errors.
This change is