<commit_before>class GraphqlController < ApplicationController

  skip_before_action :verify_authenticity_token
  skip_authorization_check

  class QueryStringError < StandardError; end

  def query
    begin
      if query_string.nil? then raise GraphqlController::QueryStringError end
      response = consul_schema.execute query_string, variables: query_variables
      render json: response, status: :ok
    rescue GraphqlController::QueryStringError
      render json: { message: 'Query string not present' }, status: :bad_request
    rescue GraphQL::ParseError
      render json: { message: 'Query string is not valid JSON' }, status: :bad_request
    end
  end

  private
<commit_msg>Rescue all exceptions in production<commit_after>class GraphqlController < ApplicationController

  skip_before_action :verify_authenticity_token
  skip_authorization_check

  class QueryStringError < StandardError; end

  def query
    begin
      if query_string.nil? then raise GraphqlController::QueryStringError end
      response = consul_schema.execute query_string, variables: query_variables
      render json: response, status: :ok
    rescue GraphqlController::QueryStringError
      render json: { message: 'Query string not present' }, status: :bad_request
    rescue GraphQL::ParseError
      render json: { message: 'Query string is not valid JSON' }, status: :bad_request
    rescue
      unless Rails.env.production? then raise end
    end
  end

  private

{'fraction_non_alphanumeric': 0.05802047781569966, 'fraction_numerical': 0.0, 'mean_word_length': 4.292418772563177, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1542414', 'n_tokens_mistral': 385, 'n_tokens_neox': 377, 'n_words': 122}