<commit_before>class MutationErrorHandler
  attr_reader :resolve_func

  def initialize(resolve_func)
    @resolve_func = resolve_func
  end

  def call(obj, args, ctx)
    resolve_func.call(obj, args, ctx)
  rescue ActiveRecord::RecordInvalid => err
    GraphQL::ExecutionError.new(
      "Invalid input for #{err.record.class.name}: #{err.record.errors.full_messages.join(', ')}"
    )
  rescue ApplicationService::ServiceFailure => err
    GraphQL::ExecutionError.new(err.result.errors.full_messages.join(', '))
  end
end<commit_msg>Show something useful on regular Ruby errors<commit_after>class MutationErrorHandler
  attr_reader :resolve_func

  def initialize(resolve_func)
    @resolve_func = resolve_func
  end

  def call(obj, args, ctx)
    resolve_func.call(obj, args, ctx)
  rescue ActiveRecord::RecordInvalid => err
    GraphQL::ExecutionError.new(
      "Invalid input for #{err.record.class.name}: #{err.record.errors.full_messages.join(', ')}"
    )
  rescue ApplicationService::ServiceFailure => err
    GraphQL::ExecutionError.new(err.result.errors.full_messages.join(', '))
  rescue StandardError => err
    GraphQL::ExecutionError.new(err.message)
  end
end
{'fraction_non_alphanumeric': 0.11714770797962648, 'fraction_numerical': 0.0, 'mean_word_length': 4.779411764705882, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '5308605', 'n_tokens_mistral': 360, 'n_tokens_neox': 360, 'n_words': 71}