<commit_before>

module.exports = (promise, res, config, errStatus) ->
  log = config.log
  promise.then (data) ->
    if data
      res.status(200).json(data)
    else
      res.status(204).end()
  promise.catch (error) ->
    log.error error
    # TODO: perhaps we dont send errors in non dev mode?
    res.status(errStatus).send error
<commit_msg>(feature) Log more informative error messages.<commit_after>

module.exports = (promise, res, config, errStatus) ->
  log = config.log
  promise.then (data) ->
    if data
      res.status(200).json(data)
    else
      res.status(204).end()
  promise.catch (error) ->
    log.error error.stack
    # TODO: perhaps we dont send errors in non dev mode?
    res.status(errStatus).send error

{'fraction_non_alphanumeric': 0.12449255751014884, 'fraction_numerical': 0.016238159675236806, 'mean_word_length': 2.9361702127659575, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '3194174', 'n_tokens_mistral': 244, 'n_tokens_neox': 238, 'n_words': 67}