You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-09 00:22:08 +03:00
chore: use Object.assign for adding error classes
This makes sure all error classes are added, no matter how many exist.
This commit is contained in:
21
index.js
21
index.js
@@ -10,18 +10,15 @@ const utils = require('./lib/utils')
|
|||||||
|
|
||||||
require('./lib/individualCommands')
|
require('./lib/individualCommands')
|
||||||
|
|
||||||
RedisClient.debugMode = /\bredis\b/i.test(process.env.NODE_DEBUG)
|
Object.assign(RedisClient, Errors, {
|
||||||
RedisClient.RedisClient = RedisClient
|
RedisClient,
|
||||||
RedisClient.Multi = Multi
|
Multi,
|
||||||
RedisClient.AbortError = Errors.AbortError
|
print: utils.print,
|
||||||
RedisClient.ParserError = Errors.ParserError
|
createClient() {
|
||||||
RedisClient.RedisError = Errors.RedisError
|
return new RedisClient(unifyOptions.apply(null, arguments))
|
||||||
RedisClient.ReplyError = Errors.ReplyError
|
},
|
||||||
RedisClient.InterruptError = Errors.InterruptError
|
debugMode = /\bredis\b/i.test(process.env.NODE_DEBUG)
|
||||||
RedisClient.print = utils.print
|
})
|
||||||
RedisClient.createClient = function () {
|
|
||||||
return new RedisClient(unifyOptions.apply(null, arguments))
|
|
||||||
}
|
|
||||||
|
|
||||||
Commands.list.forEach((name) => addCommand(RedisClient.prototype, Multi.prototype, name))
|
Commands.list.forEach((name) => addCommand(RedisClient.prototype, Multi.prototype, name))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user