<commit_before>var Boom = require('boom');

module.exports = function(error) {
  if (!error.data || !error.data.details) {
    console.error(error);
    return error.isBoom ? error : Boom.badImplementation(error);
  }

  error.output.payload.validationErrors = error.data.details.map(failure => ({<commit_msg>Add Winston logger to format-error<commit_after>var Boom = require('boom');
const logger = require('./logger');

module.exports = function(error) {
  if (!error.data || !error.data.details) {
    logger.error(error);
    return error.isBoom ? error : Boom.badImplementation(error);
  }

  error.output.payload.validationErrors = error.data.details.map(failure => ({
{'fraction_non_alphanumeric': 0.15578635014836795, 'fraction_numerical': 0.0, 'mean_word_length': 4.625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3714573', 'n_tokens_mistral': 213, 'n_tokens_neox': 208, 'n_words': 37}