Choosing error codes based on a really nice #define doesn’t necessarily lead to a readable message to the user
https://blogs.msdn.microsoft.com/oldnewthing/20181203-00/?p=100375 [blogs.msdn.microsoft.com]
2018-12-17 04:07
What happened is that the program was using some internal helper object. If somebody tries to use the object before it has been properly configured, the developer needed to return an error code to indicate this. The developer went cruising through winerror.h looking for a suitable error code, and hey look, here’s one: ERROR_NOT_READY. Awesome, let’s return that error code.
But what the developer didn’t check is how that error message looks to the user. The function that displays the error code to the user will use the FormatMessage function to perform the error-code-to-message conversion. And that produces “The device is not ready”, which is nonsense.
Applies to quite a few posix errno values as well.
source: Dfly