<commit_before>'use strict'

const querystring = require('querystring')

const database = require('../lib/storage/database')
const log = require('../lib/utility/log')
const route = require('../lib/http/route')
const request = require('./request')

module.exports.handle = (event, context, callback) => {
  let data = Object.assign({}, querystring.parse(event.body), event.pathParameters, event.queryStringParameters)
  if (!request.isValid(data, callback)) return false
  database.put(data, function (error) {
    if (error) {
      log.error(['Error adding to the database', data, event])
      route.render('receive-error', data, callback)
    }
    log.success('Successfully queued email')
    route.render('receive-success', data, callback)
  })
}<commit_msg>return false for receive request handle db put error<commit_after>'use strict'

const querystring = require('querystring')

const database = require('../lib/storage/database')
const log = require('../lib/utility/log')
const route = require('../lib/http/route')
const request = require('./request')

module.exports.handle = (event, context, callback) => {
  let data = Object.assign({}, querystring.parse(event.body), event.pathParameters, event.queryStringParameters)
  if (!request.isValid(data, callback)) return false
  database.put(data, function (error) {
    if (error) {
      log.error(['Error adding to the database', data, event])
      route.render('receive-error', data, callback)
      return false
    }
    log.success('Successfully queued email')
    route.render('receive-success', data, callback)
  })
}
{'fraction_non_alphanumeric': 0.15404040404040403, 'fraction_numerical': 0.0, 'mean_word_length': 4.446735395189004, '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': '306469', 'n_tokens_mistral': 455, 'n_tokens_neox': 445, 'n_words': 116}