You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Emit errors instead of throwing them
Thrown errors might kill the users app. By emitting the errors the user is able to catch all errors in one place without the app going down
This commit is contained in:
@@ -96,8 +96,7 @@ describe("The 'set' method", function () {
|
||||
this.timeout(200);
|
||||
|
||||
client.once("error", function (err) {
|
||||
helper.isError()(err, null);
|
||||
return done(err);
|
||||
done(err);
|
||||
});
|
||||
|
||||
client.set();
|
||||
@@ -107,20 +106,13 @@ describe("The 'set' method", function () {
|
||||
}, 100);
|
||||
});
|
||||
|
||||
it("does not throw an error", function (done) {
|
||||
this.timeout(200);
|
||||
var mochaListener = helper.removeMochaListener();
|
||||
|
||||
process.once('uncaughtException', function (err) {
|
||||
process.on('uncaughtException', mochaListener);
|
||||
return done(err);
|
||||
it("does emit an error", function (done) {
|
||||
client.on('error', function (err) {
|
||||
assert.equal(err.message, "ERR wrong number of arguments for 'set' command");
|
||||
done();
|
||||
});
|
||||
|
||||
client.set();
|
||||
|
||||
setTimeout(function () {
|
||||
done();
|
||||
}, 100);
|
||||
client.set('foo');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user