<commit_before>const micro = require('micro')
const noop = () => {}

// Mock the database
const DB = () => {
  let data = {}
  let DELAY = 1

  return {
    sync: () => ({
      get: (key) => data[key],
      put: (key, val, cb) => {
        setTimeout(() => {
          data[key] = val
          cb()
        }, DELAY)
      },
      has: (key) => ({}.hasOwnProperty.call(data, key)),
      keys: () => Object.keys(data),
      del: noop,
      clear: noop,
      close: noop,
      on: noop,
    }),<commit_msg>Make get in dbMock throw on non existing key<commit_after>const micro = require('micro')
const noop = () => {}

// Mock the database
const DB = () => {
  let data = {}
  let DELAY = 1

  return {
    sync: () => ({
      get: (key) => {
        if (!{}.hasOwnProperty.call(data, key)) {
          throw new Error('non-existing-key')
        }
        return data[key]
      },
      put: (key, val, cb) => {
        setTimeout(() => {
          data[key] = val
          cb()
        }, DELAY)
      },
      has: (key) => ({}.hasOwnProperty.call(data, key)),
      keys: () => Object.keys(data),
      del: noop,
      clear: noop,
      close: noop,
      on: noop,
    }),
{'fraction_non_alphanumeric': 0.18855218855218855, 'fraction_numerical': 0.0016835016835016834, 'mean_word_length': 1.77803738317757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '712568', 'n_tokens_mistral': 406, 'n_tokens_neox': 400, 'n_words': 101}