Improve error logging in ln import
This commit is contained in:
		
							parent
							
								
									57e0980134
								
							
						
					
					
						commit
						0243769a02
					
				@ -239,7 +239,13 @@ class LightningStatsImporter {
 | 
				
			|||||||
   */
 | 
					   */
 | 
				
			||||||
  async $importHistoricalLightningStats(): Promise<void> {
 | 
					  async $importHistoricalLightningStats(): Promise<void> {
 | 
				
			||||||
    try {
 | 
					    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
 | 
					      // Insert history from the most recent to the oldest
 | 
				
			||||||
      // This also put the .json cached files first
 | 
					      // This also put the .json cached files first
 | 
				
			||||||
      fileList.sort().reverse();
 | 
					      fileList.sort().reverse();
 | 
				
			||||||
@ -281,6 +287,8 @@ class LightningStatsImporter {
 | 
				
			|||||||
          if (e.errno == -1) { // EISDIR - Ignore directorie
 | 
					          if (e.errno == -1) { // EISDIR - Ignore directorie
 | 
				
			||||||
            continue;
 | 
					            continue;
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
 | 
					          logger.err(`Unable to open ${this.topologiesFolder}/${filename}`);
 | 
				
			||||||
 | 
					          continue;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        let graph;
 | 
					        let graph;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user