Skip to content

Commit

Permalink
Log always on error
Browse files Browse the repository at this point in the history
  • Loading branch information
dgaubert committed May 13, 2020
1 parent 8cd36df commit 9c1cdae
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,19 @@ function makePool (redisPool, database) {
});

client.on('error', (err) => {
if (!settled) {
settled = true;
client.end(FLUSH_CONNECTION);
if (settled) {
err.name = redisPool.options.name;
return redisPool.logger.error(err);
}

if (err) {
return resolve(err);
}
settled = true;
client.end(FLUSH_CONNECTION);

return resolve(client);
if (err) {
return resolve(err);
}

return resolve(client);
});

client.on('ready', () => {
Expand All @@ -161,6 +164,7 @@ function makePool (redisPool, database) {
if (err) {
return resolve(err);
}

return resolve(client);
}
});
Expand Down

0 comments on commit 9c1cdae

Please sign in to comment.