Graceful start of icat+ when there is no mongoDB or no graylog
When starting the application and graylog is not configured or not accesible it says:
Error while trying to write to graylog2: { Error: getaddrinfo ENOTFOUND graylog-dau.esrf.fr
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'graylog-dau.esrf.fr' }
Error while trying to write to graylog2: { Error: getaddrinfo ENOTFOUND graylog-dau.esrf.fr
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
code: 'ENOTFOUND',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'graylog-dau.esrf.fr' }
{ MongoNetworkError: failed to connect to server [lindemaria.esrf.fr:27017] on first connect [MongoNetworkError: getaddrinfo ENOTFOUND lindemaria.esrf.fr lindemaria.esrf.fr:27017]
at Pool.<anonymous> (/home/ale/Software/icat-plus/node_modules/mongodb-core/lib/topologies/server.js:564:11)
at emitOne (events.js:116:13)
at Pool.emit (events.js:211:7)
at Connection.<anonymous> (/home/ale/Software/icat-plus/node_modules/mongodb-core/lib/connection/pool.js:317:12)
at Object.onceWrapper (events.js:317:30)
at emitTwo (events.js:126:13)
at Connection.emit (events.js:214:7)
at Socket.<anonymous> (/home/ale/Software/icat-plus/node_modules/mongodb-core/lib/connection/connection.js:246:50)
at Object.onceWrapper (events.js:315:30)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at emitErrorNT (internal/streams/destroy.js:64:8)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
name: 'MongoNetworkError',
errorLabels: [ 'TransientTransactionError' ],
[Symbol(mongoErrorContextSymbol)]: {} }
Could not connect to the database. Exiting now...