Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 1x 1x 1x 1x 1x 14x 14x 1x 14x 14x 14x 14x 14x 14x 14x 14x 14x 1x 1x 16x 14x 14x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | 'use strict'
// @ts-check
const process = require('process')
const fs = require('fs')
const path = require('path')
const inflector = require('inflected')
const basename = path.basename(__filename)
const getClazz = file => inflector.classify(inflector.camelize(inflector.underscore(file)))
const getModule = file => require(`./${file}`)
const defineModule = file => {
const clazz = getClazz(file)
const value = getModule(file)
const writable = true
const configurable = true
const enumerable = false
const options = {
configurable,
enumerable,
writable,
value
}
Object.defineProperty(global, clazz, options)
Eif (process.env.ENABLE_GLOBAL_ERRORS_DYNAMIC_EXPORTS_AS_MODULE) {
module.exports[clazz] = value
}
}
const dynamicExports = () => {
fs.readdirSync(__dirname)
.filter(
file => file.indexOf('.') !== 0 && !file.startsWith('base') && file !== basename && file.slice(-3) === '.js'
)
.map(file => file.replace('.js', ''))
.map(file => defineModule(file))
}
Eif (process.env.ENABLE_GLOBAL_ERRORS_DYNAMIC_EXPORTS) {
dynamicExports()
}
module.exports.BaseError = require('./base_error')
module.exports.AclError = require('./acl_error')
module.exports.AuthenticationError = require('./authentication_error')
module.exports.ConfigError = require('./config_error')
module.exports.DatabaseError = require('./database_error')
module.exports.FatalError = require('./fatal_error')
module.exports.GeneralError = require('./general_error')
module.exports.InvalidArgumentError = require('./invalid_argument_error')
module.exports.NotFoundError = require('./not_found_error')
module.exports.ProviderError = require('./provider_error')
module.exports.RuntimeError = require('./runtime_error')
module.exports.ServerError = require('./server_error')
module.exports.TransactionError = require('./transaction_error')
module.exports.UnknownError = require('./unknown_error')
module.exports.ValidationError = require('./validation_error')
|