chriso / redback

A high-level Redis library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Catching redis connection errors

JulesAU opened this issue · comments

If I was using the Redis library directly, I would catch connection errors like so:

var redis = require("redis"),
    client = redis.createClient();

client.on("error", function (err) {
    // No Redis server instance running?
    console.log("Error " + err);
});

How can I achieve this when I'm using redback? I don't appear to have access to the underlying Redis object.

Thanks - Jules

You can access the client like this:

var redback = require('redback').createClient();

redback.client.on('error', function (err) {
    //etc.
});

Should probably put this in the documentation ;)

thanks Chris, works a treat. Nice implementation of rate-limiting, BTW.