I'm new to node.js and trying to teach myself node with orientdb as the datastore. I'm using oriento as the driver.
I want to be able to handle any connection errors in my code but cannot find any examples of how to do this during the initial connection to orientdb server and connection to my database:
var express = require('express');
var oriento = require('oriento');
var server = oriento({
host: "localhost",
port: 2424,
username: "root",
password: "test"
});
How do I catch if there is connection error to the server? Later on when I want to work with a specific database in the server:
var db = server.use({
name: 'blog',
username: 'admin',
password: 'admin'
});
How do I catch if there is an error in "use"ing this database?
I can sort of figure out from the oriento documentation how to handle errors during queries etc., but got stuck in these initial steps.
Here is how. Basically, it does auto connect to the server on the first request. For connection errors you need
catch
on every request.