Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bubble up error so that I can kill my server if there is no redis sentinel connection #57

Open
ORESoftware opened this issue May 27, 2015 · 0 comments

Comments

@ORESoftware
Copy link

If I have these two lines of code:

var Sentinel = sentinel.Sentinel(endpoints);
var client = Sentinel.createClient(REDIS_SENTINEL_MASTER_NAME, {role: 'master'});

When Redis is not running, or it is misconfigured, your library will throw an error - Error: Failed to find a sentinel from the endpoints

However, the error is not fatal and my server keeps running.

(1) I want to trap that error and decide if I should kill my server.
(2) I want to find out where in my program the error is occurring; as of now, it's hard to track down.

In most sophisticated languages, errors will "bubble up" if you enclose them with a try/catch block:

try{
    var Sentinel = sentinel.Sentinel(endpoints);
    var client = Sentinel.createClient(REDIS_SENTINEL_MASTER_NAME, {role: 'master'});
}
catch(e){
    throw e;
}

but I am unable to trap the errors. Your library throws the error internally, but doesn't give me enough information to trap the error.

Am I using the wrong approach?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant