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