<commit_before>Boom = require 'boom'

module.exports = ->
  (err, req, res, next) ->
    unless err instanceof Error then err = new Error err
    status = err.statusCode or err.status
    message = if status then err.message else null
    Boom.wrap(err, status, message)
    err.reformat()
    res.set err.output.headers
    res.status err.output.statusCode
    res.json err.output.payload<commit_msg>remove duplicate message<commit_after>Boom = require 'boom'

module.exports = ->
  (err, req, res, next) ->
    unless err instanceof Error then err = new Error err
    status = err.statusCode or err.status
    Boom.wrap(err, status)
    err.reformat()
    res.set err.output.headers
    res.status err.output.statusCode
    res.json err.output.payload
{'fraction_non_alphanumeric': 0.10225763612217796, 'fraction_numerical': 0.0, 'mean_word_length': 3.165745856353591, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7510550', 'n_tokens_mistral': 233, 'n_tokens_neox': 232, 'n_words': 69}