<commit_before>from constants import *

class RetryableError(Exception):
  """
  RetryableError is a generic error that other errors inherit from.  An error is considered
  retryable if it does not cause the state machine to halt.
  """

class PacketDecodeError(RetryableError):
  """
  Error that occured when evaluating a packet. These errors are caused by problems that
  are potentially recoverable.
  """
  def __init__(self, actual, expected):
    self.value = {
        'ExpectedValue' : expected,
        'ActualValue'   : actual,
        }

  def __str__(self):
    return str(self.value)

class PacketLengthError(PacketDecodeError):
  """
  Signifies an error in the length of a packet
  """

class PacketLengthFieldError(PacketDecodeError):
  """
  Signifies an error in a specific field of the packet (i.e. the payload isnt the correct length
  """

class PacketHeaderError(PacketDecodeError):
  """
  Signifies an incorrect header on a packet
  """

class PacketCRCError(PacketDecodeError):
  """
  Signifies a mismatch in expected and actual CRCs
  """

class GenericError(RetryableError):
  """
  A generic error reported by the bot
  """

class CRCMismatchError(RetryableError):
  """
  Signifies a bad crc code was received by the machine
  """

class TimeoutError(RetryableError):
  """
  Signifies that a packet has taken too long to be received
  """
  def __init__(self, data_length, decoder_state):
    self.data_length = data_length
    self.decoder_state = decoder_state
    self.value = {
        'DATA LENGTH':self.data_length,  
        'DECODER STATE':self.decoder_state
        }


class BufferOverflowError(Exception):
  """
  Signifies a reported overflow of the buffer from the bot
  """

class BuildCancelledError(Exception):
  """
  Signifies the cancellation of a build
  """

class ActiveBuildError(Exception):
  """ 
  Signigifies a report that the the bot is actively building from a local source
  """

class OverheatError(Exception):
  """
  Signifies that the bot is reporting and overheat state and can no longer accept commands
  """

class CommandNotSupportedError(Exception):
  """
  Signifies that the bot reported receiving a command it does not support
  """

class TransmissionError(IOError):
  """
  A transmission error is raised when the s3g driver encounters 
  too many errors while communicating, OR the machine encountering
  errors when communicating with its tools. This error is non-recoverable 
  without resetting the state of the machine.
  """<commit_msg>updated error documentation.<commit_after>from constants import *

class RetryableError(Exception):
  """
  RetryableError is a generic error that other errors inherit from.  An error is considered
  retryable if it does not cause the state machine to halt.
  """

class PacketDecodeError(RetryableError):
  """
  Error that occured when evaluating a packet. These errors are caused by problems that
  are potentially recoverable.
  """
  def __init__(self, actual, expected):
    self.value = {
        'ExpectedValue' : expected,
        'ActualValue'   : actual,
        }

  def __str__(self):
    return str(self.value)

class PacketLengthError(PacketDecodeError):
  """
  Signifies an error in the length of a packet
  """

class PacketLengthFieldError(PacketDecodeError):
  """
  Signifies an error in a specific field of the packet (i.e. the payload isnt the correct length
  """

class PacketHeaderError(PacketDecodeError):
  """
  Signifies an incorrect header on a packet
  """

class PacketCRCError(PacketDecodeError):
  """
  Signifies a mismatch in expected and actual CRCs
  """

class GenericError(RetryableError):
  """
  A generic error reported by the bot
  """

class CRCMismatchError(RetryableError):
  """
  Signifies a bad crc code was received by the machine
  """

class TimeoutError(RetryableError):
  """
  Signifies that a packet has taken too long to be received
  """
  def __init__(self, data_length, decoder_state):
    self.data_length = data_length
    self.decoder_state = decoder_state
    self.value = {
        'DATA LENGTH':self.data_length,  
        'DECODER STATE':self.decoder_state
        }


class BufferOverflowError(Exception):
  """
  Signifies a reported overflow of the buffer from the bot
  """

class BuildCancelledError(Exception):
  """
  Signifies the cancellation of a build.  This is ALSO
  not mispelled, its just the British way of spelling 
  Cancelled.
  """

class ActiveBuildError(Exception):
  """ 
  Signigifies a report that the the bot is actively building from a local source
  """

class OverheatError(Exception):
  """
  Signifies that the bot is reporting and overheat state and can no longer accept commands
  """

class CommandNotSupportedError(Exception):
  """
  Signifies that the bot reported receiving a command it does not support
  """

class TransmissionError(IOError):
  """
  A transmission error is raised when the s3g driver encounters 
  too many errors while communicating, OR the machine encountering
  errors when communicating with its tools. This error is non-recoverable 
  without resetting the state of the machine.
  """
{'fraction_non_alphanumeric': 0.07674328009349435, 'fraction_numerical': 0.00038955979742890534, 'mean_word_length': 3.8397737983034874, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4118874', 'n_tokens_mistral': 1439, 'n_tokens_neox': 1398, 'n_words': 541}