<commit_before>module.exports =
  notFound: (req, res) ->
    res.status 404
    res.render 'error/404', url: req.url

  internalError: (err, req, res, next) ->
    res.status 500
    res.render 'error/500'<commit_msg>Add middleware for catching validation errors<commit_after>module.exports =
  notFound: (req, res) ->
    res.status 404
    res.render 'error/404', url: req.url

  validationError: (err, req, res, next) ->
    if err.code == 'E_VALIDATION'
      req.flash 'error', err.reason
      res.redirect 'back'
    else
      next err

  internalError: (err, req, res) ->
    res.status 500
    res.render 'error/500'
{'fraction_non_alphanumeric': 0.1339712918660287, 'fraction_numerical': 0.03827751196172249, 'mean_word_length': 2.900621118012422, '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': '5973993', 'n_tokens_mistral': 232, 'n_tokens_neox': 208, 'n_words': 57}