You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
feat(parser): update to latest Redis parser & errors (#1470)
* Update redis errors and redis parser * Fix lint errors * Add node 12 to travis ci * Add appveyor node 12 * Fix some of existing errors This drops support for hiredis.
This commit is contained in:
committed by
GitHub
parent
1f082aca54
commit
78936ac50c
@@ -14,6 +14,7 @@ node_js:
|
|||||||
- "4"
|
- "4"
|
||||||
- "6"
|
- "6"
|
||||||
- "8"
|
- "8"
|
||||||
|
- "12"
|
||||||
after_success: npm run coveralls
|
after_success: npm run coveralls
|
||||||
before_script:
|
before_script:
|
||||||
# Add an IPv6 config - see the corresponding Travis issue
|
# Add an IPv6 config - see the corresponding Travis issue
|
||||||
|
@@ -8,6 +8,7 @@ environment:
|
|||||||
- nodejs_version: "4"
|
- nodejs_version: "4"
|
||||||
- nodejs_version: "6"
|
- nodejs_version: "6"
|
||||||
- nodejs_version: "8"
|
- nodejs_version: "8"
|
||||||
|
- nodejs_version: "12"
|
||||||
|
|
||||||
pull_requests:
|
pull_requests:
|
||||||
do_not_increment_build_number: true
|
do_not_increment_build_number: true
|
||||||
|
7
index.js
7
index.js
@@ -9,6 +9,7 @@ var Queue = require('denque');
|
|||||||
var errorClasses = require('./lib/customErrors');
|
var errorClasses = require('./lib/customErrors');
|
||||||
var EventEmitter = require('events');
|
var EventEmitter = require('events');
|
||||||
var Parser = require('redis-parser');
|
var Parser = require('redis-parser');
|
||||||
|
var RedisErrors = require('redis-errors');
|
||||||
var commands = require('redis-commands');
|
var commands = require('redis-commands');
|
||||||
var debug = require('./lib/debug');
|
var debug = require('./lib/debug');
|
||||||
var unifyOptions = require('./lib/createClient');
|
var unifyOptions = require('./lib/createClient');
|
||||||
@@ -1090,9 +1091,9 @@ exports.RedisClient = RedisClient;
|
|||||||
exports.print = utils.print;
|
exports.print = utils.print;
|
||||||
exports.Multi = require('./lib/multi');
|
exports.Multi = require('./lib/multi');
|
||||||
exports.AbortError = errorClasses.AbortError;
|
exports.AbortError = errorClasses.AbortError;
|
||||||
exports.RedisError = Parser.RedisError;
|
exports.RedisError = RedisErrors.RedisError;
|
||||||
exports.ParserError = Parser.ParserError;
|
exports.ParserError = RedisErrors.ParserError;
|
||||||
exports.ReplyError = Parser.ReplyError;
|
exports.ReplyError = RedisErrors.ReplyError;
|
||||||
exports.AggregateError = errorClasses.AggregateError;
|
exports.AggregateError = errorClasses.AggregateError;
|
||||||
|
|
||||||
// Add all redis commands / node_redis api to the client
|
// Add all redis commands / node_redis api to the client
|
||||||
|
@@ -2,14 +2,13 @@
|
|||||||
|
|
||||||
var util = require('util');
|
var util = require('util');
|
||||||
var assert = require('assert');
|
var assert = require('assert');
|
||||||
var RedisError = require('redis-parser').RedisError;
|
var RedisError = require('redis-errors').RedisError;
|
||||||
var ADD_STACKTRACE = false;
|
var ADD_STACKTRACE = false;
|
||||||
|
|
||||||
function AbortError (obj, stack) {
|
function AbortError (obj, stack) {
|
||||||
assert(obj, 'The options argument is required');
|
assert(obj, 'The options argument is required');
|
||||||
assert.strictEqual(typeof obj, 'object', 'The options argument has to be of type object');
|
assert.strictEqual(typeof obj, 'object', 'The options argument has to be of type object');
|
||||||
|
|
||||||
RedisError.call(this, obj.message, ADD_STACKTRACE);
|
|
||||||
Object.defineProperty(this, 'message', {
|
Object.defineProperty(this, 'message', {
|
||||||
value: obj.message || '',
|
value: obj.message || '',
|
||||||
configurable: true,
|
configurable: true,
|
||||||
|
@@ -27,7 +27,8 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"denque": "^1.2.3",
|
"denque": "^1.2.3",
|
||||||
"redis-commands": "^1.4.0",
|
"redis-commands": "^1.4.0",
|
||||||
"redis-parser": "^2.6.0"
|
"redis-errors": "^1.2.0",
|
||||||
|
"redis-parser": "^3.0.0"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.10.0"
|
"node": ">=0.10.0"
|
||||||
|
@@ -359,7 +359,7 @@ describe('The node_redis client', function () {
|
|||||||
|
|
||||||
it('send_command with callback as args', function (done) {
|
it('send_command with callback as args', function (done) {
|
||||||
client.send_command('abcdef', function (err, res) {
|
client.send_command('abcdef', function (err, res) {
|
||||||
assert.strictEqual(err.message, "ERR unknown command 'abcdef'");
|
assert.strictEqual(err.message, 'ERR unknown command `abcdef`, with args beginning with: ');
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -50,7 +50,7 @@ describe('rename commands', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
client.get('key', function (err, reply) {
|
client.get('key', function (err, reply) {
|
||||||
assert.strictEqual(err.message, "ERR unknown command 'get'");
|
assert.strictEqual(err.message, 'ERR unknown command `get`, with args beginning with: `key`, ');
|
||||||
assert.strictEqual(err.command, 'GET');
|
assert.strictEqual(err.command, 'GET');
|
||||||
assert.strictEqual(reply, undefined);
|
assert.strictEqual(reply, undefined);
|
||||||
});
|
});
|
||||||
@@ -108,7 +108,7 @@ describe('rename commands', function () {
|
|||||||
multi.exec(function (err, res) {
|
multi.exec(function (err, res) {
|
||||||
assert(err);
|
assert(err);
|
||||||
assert.strictEqual(err.message, 'EXECABORT Transaction discarded because of previous errors.');
|
assert.strictEqual(err.message, 'EXECABORT Transaction discarded because of previous errors.');
|
||||||
assert.strictEqual(err.errors[0].message, "ERR unknown command 'get'");
|
assert.strictEqual(err.errors[0].message, 'ERR unknown command `get`, with args beginning with: `key`, ');
|
||||||
assert.strictEqual(err.errors[0].command, 'GET');
|
assert.strictEqual(err.errors[0].command, 'GET');
|
||||||
assert.strictEqual(err.code, 'EXECABORT');
|
assert.strictEqual(err.code, 'EXECABORT');
|
||||||
assert.strictEqual(err.errors[0].code, 'ERR');
|
assert.strictEqual(err.errors[0].code, 'ERR');
|
||||||
|
Reference in New Issue
Block a user