<commit_before>module Rack
  module Spec
    class Error < StandardError
      # @return [Array] Rack response
      def to_rack_response
        [status, headers, [body]]
      end

      private

      # @note Override this
      def status
        500
      end

      # @note Override this
      def id
        "internal_server_error"
      end

      def headers
        { "Content-Type" => "application/json" }
      end

      def body
        { id: id, message: message }.to_json
      end
    end
  end
end<commit_msg>Prettify all JSON response for user-friendliness<commit_after>module Rack
  module Spec
    class Error < StandardError
      # @return [Array] Rack response
      def to_rack_response
        [status, headers, [body]]
      end

      private

      # @note Override this
      def status
        500
      end

      # @note Override this
      def id
        "internal_server_error"
      end

      def headers
        { "Content-Type" => "application/json" }
      end

      def body
        MultiJson.encode({ id: id, message: message }, pretty: true) + "\n"
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.07232142857142858, 'fraction_numerical': 0.005357142857142857, 'mean_word_length': 1.7341463414634146, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7520409', 'n_tokens_mistral': 338, 'n_tokens_neox': 320, 'n_words': 103}