Open tailhook opened 10 years ago
I'm not against this idea. I don't want to do anything yet that would break python2/3 compatibility, maybe backporting the exceptions to 2 would be possible (already done by the "six" package?). My current position is that I like the idea of having a single root exception that can be caught for any nanomsg error, it allows for very simple error handling, perhaps not what you would want to do in critical code but useful at times.
I believe it may look like:
try:
base_class = InterrutedError
except NameError:
base_class = OSError
class NNInterruptedError(BaseNNError, base_class):
pass
This way it would work in both python versions
See PEP 3151 for details on exceptions.
In particular it would be nice to raise BlockingIOError and InterruptedError. I'm not sure whether we should subclass them or just use raw built-in classes.