scott-griffiths / bitstring

A Python module to help you manage your bits
https://bitstring.readthedocs.io/en/stable/index.html
MIT License
401 stars 67 forks source link

Rationalise Error classes #296

Closed scott-griffiths closed 1 month ago

scott-griffiths commented 10 months ago

I can't remember the motivation for having so many specialised error classes (I suspect just because I could) and they can become a bit annoying.

Sometimes a given issue should be an InterpretError, and sometimes a CreationError depending on the context the code is used in. Both derive from ValueError, and I think I'd be happy for them both to be ValueErrors.

Similarly ReadError derives from IndexError and doesn't add anything to it.

ByteAlignError is at least a bit distinctive, and gives slightly more information than alternatives.

Suggest that for version 4.2 we change from deriving from the base class to just being an alias for it. That shouldn't break any code and would allow some simplifications

scott-griffiths commented 1 month ago

This is one of the changes I will instead prioritise for the bitformat library.