<commit_before>module Gtt

  require 'rainbow'
  class Output

    def initialize(response)
      if response['ok']
        puts 'OK!'.color(:green)
      else
        error = "ERROR:".color(:red)
        puts "#{error} #{response['message']}"
      end
    end

  end

end<commit_msg>Improve error handler<commit_after>module Gtt

  require 'rainbow'
  class Output

    def initialize(response)
      if response['ok']
        output = render_success(response)
      elsif response['error']
        output = render_error(response)
      else
        output = 'Unknown message'.color(:yellow)
      end
      puts output
    end

    def render_success(response)
      output = 'OK! '.color(:green)
      if response['message']
        output += response['message'].to_s
      end
      output
    end

    def render_error(response)
      output = "ERROR: ".color(:red)
      if response['message']
        output += response['message'].to_s
      end
      output
    end

  end

end
{'fraction_non_alphanumeric': 0.10953346855983773, 'fraction_numerical': 0.0, 'mean_word_length': 2.2682119205298013, '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': '6297601', 'n_tokens_mistral': 294, 'n_tokens_neox': 284, 'n_words': 73}