<commit_before>FlashMessage = require '../flash/index.coffee'
Errors = require '../form/errors.coffee'
rg4js = require 'raygun4js'

module.exports = (error) ->
  rg4js 'send', error

  parser = new Errors $('<form></form>')

  message = parser.parse error

  subject = encodeURIComponent 'Problem with sending inquiry'

  body = encodeURIComponent "
    URL: #{window.location.href}
    Message: #{message}
  "

  new FlashMessage
    message: "
      There has been an error:<br>
      #{message}<br>
      Click here to contact <EMAIL>
    "
    href: "mailto:<EMAIL>?subject=#{subject}&body=#{body}"
    autoclose: false
    safe: false<commit_msg>Only require Raygun if key is set<commit_after>FlashMessage = require '../flash/index.coffee'
Errors = require '../form/errors.coffee'
sd = require('sharify').data

module.exports = (error) ->
  if sd.RAYGUN_KEY
    rg4js ?= require 'raygun4js'
    rg4js 'send', error

  parser = new Errors $('<form></form>')

  message = parser.parse error

  subject = encodeURIComponent 'Problem with sending inquiry'

  body = encodeURIComponent "
    URL: #{window.location.href}
    Message: #{message}
  "

  new FlashMessage
    message: "
      There has been an error:<br>
      #{message}<br>
      Click here to contact <EMAIL>
    "
    href: "mailto:<EMAIL>?subject=#{subject}&body=#{body}"
    autoclose: false
    safe: false
{'fraction_non_alphanumeric': 0.13798111837327523, 'fraction_numerical': 0.004357298474945534, 'mean_word_length': 3.3607594936708862, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, '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': '2079', 'n_tokens_mistral': 461, 'n_tokens_neox': 445, 'n_words': 115}