Files
mdecker62 d9ba2ef19c k
2026-03-03 14:22:48 -05:00

16 lines
478 B
Python

class BitsError(Exception):
message = "Bits error"
def __str__(self):
return self.message
class NotEnoughBits(BitsError):
def __init__(self, obj, length):
self.message = f"{obj} cannot fit into {length} bits."
class IntegersRequireLength(BitsError):
message = "Binary representations of integers require that a length be provided."
class IntegerAdditionRequiresSameLength(BitsError):
message = "Can only add integers of the same length."