Improve error logging in ln import

This commit is contained in:
nymkappa 2022-08-18 11:14:34 +02:00
parent 57e0980134
commit 0243769a02
No known key found for this signature in database
GPG Key ID: E155910B16E8BD04

View File

@ -239,7 +239,13 @@ class LightningStatsImporter {
*/
async $importHistoricalLightningStats(): Promise<void> {
try {
const fileList = await fsPromises.readdir(this.topologiesFolder);
let fileList: string[] = [];
try {
fileList = await fsPromises.readdir(this.topologiesFolder);
} catch (e) {
logger.err(`Unable to open topology folder at ${this.topologiesFolder}`);
throw e;
}
// Insert history from the most recent to the oldest
// This also put the .json cached files first
fileList.sort().reverse();
@ -281,6 +287,8 @@ class LightningStatsImporter {
if (e.errno == -1) { // EISDIR - Ignore directorie
continue;
}
logger.err(`Unable to open ${this.topologiesFolder}/${filename}`);
continue;
}
let graph;