Skip to content

AUTH Failure returns instead of using callback #427

@cressie176

Description

@cressie176

I'd like to use the AUTH callback to be notified of invalid passwords, however instead of passing the callback and error.

            if (err.toString().match("LOADING")) {
                // if redis is still loading the db, it will not authenticate and everything else will fail
                console.log("Redis still loading, trying to authenticate later");
                setTimeout(function () {
                    self.do_auth();
                }, 2000); // TODO - magic number alert
                return;
            } else {
                // INVALID PASSWORD PATH ENTERS HERE AND RETURNS
                return self.emit("error", new Error("Auth error: " + err.message));
            }
// THE FOLLOWING CODE IS NOT EXECUTED
        if (res.toString() !== "OK") {
            return self.emit("error", new Error("Auth failed: " + res.toString()));
        }
        if (exports.debug_mode) {
            console.log("Auth succeeded " + self.host + ":" + self.port + " id " + self.connection_id);
        }
        if (self.auth_callback) {
            self.auth_callback(err, res);
            self.auth_callback = null;
        }

Any chance of changing the above to so it calls self.auth_callback if present on any error? Happy to fork and send a pull request.

Steve

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions