fix: add error handling in case of unvailable cache server
Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
This commit is contained in:
parent
a206198e31
commit
feaecba71c
|
@ -499,7 +499,15 @@ DataSource.prototype.setup = function(dsName, settings) {
|
||||||
debug('Connection fails: %s\nIt will be retried for the next request.', err);
|
debug('Connection fails: %s\nIt will be retried for the next request.', err);
|
||||||
} else {
|
} else {
|
||||||
g.error('Connection fails: %s\nIt will be retried for the next request.', err);
|
g.error('Connection fails: %s\nIt will be retried for the next request.', err);
|
||||||
|
if (settings.catchFailure) {
|
||||||
|
try {
|
||||||
this.emit('error', err);
|
this.emit('error', err);
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.emit('error', err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Either lazyConnect or connector initialize() defers the connection
|
// Either lazyConnect or connector initialize() defers the connection
|
||||||
|
|
Loading…
Reference in New Issue