<commit_before>class DynamicDialogFieldValueProcessor
  def self.values_from_automate(dialog_field)
    new.values_from_automate(dialog_field)
  end

  def values_from_automate(dialog_field)
    dialog_values = {:dialog => dialog_field.dialog.try(:automate_values_hash)}
    workspace = dialog_field.resource_action.deliver_to_automate_from_dialog_field(
      dialog_values,
      dialog_field.dialog.try(:target_resource),
      User.current_user
    )

    dialog_field.normalize_automate_values(workspace.root.attributes)
  rescue
    dialog_field.script_error_values
  end
end<commit_msg>Log properly dynamic dialog field script error<commit_after>class DynamicDialogFieldValueProcessor
  def self.values_from_automate(dialog_field)
    new.values_from_automate(dialog_field)
  end

  def values_from_automate(dialog_field)
    dialog_values = {:dialog => dialog_field.dialog.try(:automate_values_hash)}
    workspace = dialog_field.resource_action.deliver_to_automate_from_dialog_field(
      dialog_values,
      dialog_field.dialog.try(:target_resource),
      User.current_user
    )

    dialog_field.normalize_automate_values(workspace.root.attributes)
  rescue => e
    $log.error "DynamicDialogFieldValueProcessor: error getting value from automate #{e.message}"
    $log.error e.backtrace.join("\n")

    dialog_field.script_error_values
  end
end
{'fraction_non_alphanumeric': 0.07494489346069066, 'fraction_numerical': 0.0, 'mean_word_length': 5.305555555555555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '129208', 'n_tokens_mistral': 421, 'n_tokens_neox': 415, 'n_words': 58}