Skip to content

Commit feaecba

Browse files
aaqilnizsamarpanB
authored andcommitted
fix: add error handling in case of unvailable cache server
Signed-off-by: Muhammad Aaqil <[email protected]>
1 parent a206198 commit feaecba

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

lib/datasource.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,15 @@ DataSource.prototype.setup = function(dsName, settings) {
499499
debug('Connection fails: %s\nIt will be retried for the next request.', err);
500500
} else {
501501
g.error('Connection fails: %s\nIt will be retried for the next request.', err);
502-
this.emit('error', err);
502+
if (settings.catchFailure) {
503+
try {
504+
this.emit('error', err);
505+
} catch (error) {
506+
console.log(error);
507+
}
508+
} else {
509+
this.emit('error', err);
510+
}
503511
}
504512
} else {
505513
// Either lazyConnect or connector initialize() defers the connection

0 commit comments

Comments
 (0)