scott-griffiths / bitstring

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

Rationalise Error classes #296

Closed scott-griffiths closed 5 months ago

scott-griffiths commented 1 year 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 5 months ago

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