<commit_before>module Beaneater
  class NotConnected < RuntimeError; end
  class WaitingForJobError < RuntimeError; end
  class InvalidTubeName < RuntimeError; end

  class UnexpectedResponse < RuntimeError
    ERROR_STATES = %w(OUT_OF_MEMORY INTERNAL_ERROR
      BAD_FORMAT UNKNOWN_COMMAND JOB_TOO_BIG DRAINING
      TIMED_OUT DEADLINE_SOON NOT_FOUND)

    attr_reader :status, :cmd

    def initialize(status=nil, cmd=nil)
      @status, @cmd = status, cmd
      super("Response failed with: #{status}")
    end

    # UnexpectedResponse.from_response('NOT_FOUND') => NotFoundError
    # UnexpectedResponse.from_response('OUT_OF_MEMORY') => OutOfMemoryError
    def self.from_status(status, cmd)
      error_klazz_name = status.split('_').map { |w| w.capitalize }.join
      error_klazz_name << "Error" unless error_klazz_name =~ /Error$/
      error_klazz = Beaneater.const_get(error_klazz_name)
      error_klazz.new(status, cmd)
    end
  end

  class OutOfMemoryError < UnexpectedResponse; end
  class DrainingError < UnexpectedResponse; end
  class NotFoundError < UnexpectedResponse; end
  class DeadlineSoonError < UnexpectedResponse; end
  class InternalError < UnexpectedResponse; end
  class BadFormatError < UnexpectedResponse; end
  class UnknownCommandError < UnexpectedResponse; end
  class ExpectedCRLFError < UnexpectedResponse; end
  class JobTooBigError < UnexpectedResponse; end
  class TimedOutError < UnexpectedResponse; end
end<commit_msg>[errors] add missing exceptions and remove unused exceptions<commit_after>module Beaneater
  class NotConnected < RuntimeError; end
  class InvalidTubeName < RuntimeError; end

  class UnexpectedResponse < RuntimeError
    ERROR_STATES = %w(OUT_OF_MEMORY INTERNAL_ERROR
      BAD_FORMAT UNKNOWN_COMMAND JOB_TOO_BIG DRAINING
      TIMED_OUT DEADLINE_SOON NOT_FOUND NOT_IGNORED EXPECTED_CRLF)

    attr_reader :status, :cmd

    def initialize(status, cmd)
      @status, @cmd = status, cmd
      super("Response failed with: #{status}")
    end

    # UnexpectedResponse.from_response('NOT_FOUND') => NotFoundError
    # UnexpectedResponse.from_response('OUT_OF_MEMORY') => OutOfMemoryError
    def self.from_status(status, cmd)
      error_klazz_name = status.split('_').map { |w| w.capitalize }.join
      error_klazz_name << "Error" unless error_klazz_name =~ /Error$/
      error_klazz = Beaneater.const_get(error_klazz_name)
      error_klazz.new(status, cmd)
    end
  end

  class OutOfMemoryError < UnexpectedResponse; end
  class DrainingError < UnexpectedResponse; end
  class NotFoundError < UnexpectedResponse; end
  class DeadlineSoonError < UnexpectedResponse; end
  class InternalError < UnexpectedResponse; end
  class BadFormatError < UnexpectedResponse; end
  class UnknownCommandError < UnexpectedResponse; end
  class ExpectedCRLFError < UnexpectedResponse; end
  class JobTooBigError < UnexpectedResponse; end
  class TimedOutError < UnexpectedResponse; end
  class NotIgnoredError < UnexpectedResponse; end
end
{'fraction_non_alphanumeric': 0.07014028056112225, 'fraction_numerical': 0.0, 'mean_word_length': 4.737547892720307, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 7, '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': '2937006', 'n_tokens_mistral': 917, 'n_tokens_neox': 892, 'n_words': 220}