improve error handling for netdb create
This commit is contained in:
parent
4bba10717a
commit
806fc79eea
1 changed files with 7 additions and 3 deletions
10
app.js
10
app.js
|
|
@ -46,9 +46,13 @@ netdb.create = async function(map = {}) {
|
|||
Object.assign(map, JSON.parse(fs.readFileSync(map.conf)));
|
||||
}
|
||||
const client = new netdb();
|
||||
if (map.host && map.port) await client.open(map.host, map.port);
|
||||
if (map.user && map.pass) await client.auth(map.user, map.pass);
|
||||
if (map.base) await client.use(map.base);
|
||||
try {
|
||||
if (map.host && map.port) await client.open(map.host, map.port);
|
||||
if (map.user && map.pass) await client.auth(map.user, map.pass);
|
||||
if (map.base) await client.use(map.base);
|
||||
} catch (e) {
|
||||
logger.log({ netdb_setup_error: e });
|
||||
}
|
||||
logger.log({ netdb: map.host, user: map.user, base: map.base });
|
||||
return client;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue