arangojs: How to handle connection errors ?

Seems like Database() do not have any error callbacks and do not have any of the connected()/state() functions. How to know that connection was successful/unsuccessful ? For example doing connection to the unresolved host will not return any errors at the following simple example:

var db_config = {
  url: 'http://root:@some.unknown.host:8529',
  retryConnection: true
};
var db = new arangodb.Database(db_config);
db.listCollections(/* false */)
 .then(collections => {
   for (var i in collections) {
     console.log(collections[i]);
   }
}, err => {
  console.log('listCollections error: ' + err);
});

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

@Sfinx had the some problem - now i do a http call to /_api/version to check if DB is up

We iterated over several implementations before arriving at the http connection code we use now in arangojs.

And what problems did you meet with websockets ? It is ideal for such things :

  • keepalive
  • http compatibility
  • fast
  • browsers/nodejs support
  • secure

IMHO HTTP is "back to the 2000 years " way