fix: add error handling in case of unvailable cache server

Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
This commit is contained in:
Muhammad Aaqil 2023-11-24 22:40:10 +05:00 committed by Samarpan Bhattacharya
parent a206198e31
commit feaecba71c
1 changed files with 9 additions and 1 deletions

View File

@ -499,7 +499,15 @@ DataSource.prototype.setup = function(dsName, settings) {
debug('Connection fails: %s\nIt will be retried for the next request.', err);
} else {
g.error('Connection fails: %s\nIt will be retried for the next request.', err);
if (settings.catchFailure) {
try {
this.emit('error', err);
} catch (error) {
console.log(error);
}
} else {
this.emit('error', err);
}
}
} else {
// Either lazyConnect or connector initialize() defers the connection