Description
@RX14 , it's a question related to #4832. I just wanted to continue here because the conversation can turn out to be long. You said:
I deeply disagree with creating a WinError class. Errno is platform-specific, and it needs to go. Exception hierarchy should never depend on the platform you're running on.
For now mapping to errno will work but we must remove errno before the first release. We should abstract the exception hierarchy to be platform specific. There's a good document on how python did this that we can take inspiration from. Doing that is beyond the scope of this pr though.
I'm a bit confused by these words so decided to take "how python handles exceptions now" as a core statement :)
There is PEP 3151 which describes the OS and IO exception hierarchy in python. So basically, in spite of the fact that python has a number of different exceptions, it only uses one OSError when it comes to work with a system function which returns a system-related error.
OSError has errno attribute under Unix but errno and winerror attributes under Windows. Under Windows, the errno attribute is loosely determined from the Windows error code, mapper source.
For me, Errno class in crystal looks the same as OSError in python. So did you suggest to add winerror field into Errno class?