<commit_before>import * as request from 'request'
import * as app from '../ui/lib/app'

/** Report the error to Central. */
export function reportError(error: Error) {
  const payload = {
    name: error.name,
    message: error.message,
    stack: error.stack,
    version: app.getVersion(),
  }

  const options = {
    formData: payload,
    json: true,
  }

  request.post('https://central.github.com/api/desktop/exception', options, (error, response, body) => {
    if (error) {
      console.error('Error submitting exception report:')
      console.error(error)
    } else {
      console.log('Exception reported.')
    }
  })
}<commit_msg>Pull the endpoint out into a constant<commit_after>import * as request from 'request'
import * as app from '../ui/lib/app'

const ErrorEndpoint = 'https://central.github.com/api/desktop/exception'

/** Report the error to Central. */
export function reportError(error: Error) {
  const payload = {
    name: error.name,
    message: error.message,
    stack: error.stack,
    version: app.getVersion(),
  }

  const options = {
    formData: payload,
    json: true,
  }

  request.post(ErrorEndpoint, options, (error, response, body) => {
    if (error) {
      console.error('Error submitting exception report:')
      console.error(error)
    } else {
      console.log('Exception reported.')
    }
  })
}
{'fraction_non_alphanumeric': 0.13800738007380073, 'fraction_numerical': 0.0, 'mean_word_length': 3.059880239520958, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '4420580', 'n_tokens_mistral': 418, 'n_tokens_neox': 405, 'n_words': 109}