Skip to content

Commit

Permalink
catch opendir errors
Browse files Browse the repository at this point in the history
  • Loading branch information
partouf committed Jun 22, 2024
1 parent 8e8ae40 commit 0144c71
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions build-annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,22 +71,26 @@ class BuildAnnotations {

const allAnnotations = [];

const dir = await fs.opendir(rootpath);
for await (const dirent of dir) {
if (dirent.isDirectory()) {
const buildhash = dirent.name;

const annotationFilepath = this.getAnnotationsFilepath(library, version, buildhash);
const infoFilepath = this.getConanInfoFilepath(library, version, buildhash);

const details = {
buildhash: buildhash,
annotation: await this.readAnnotationFromFile(annotationFilepath),
buildinfo: await this.readConanInfoFromFile(infoFilepath),
};

allAnnotations.push(details);
try {
const dir = await fs.opendir(rootpath);
for await (const dirent of dir) {
if (dirent.isDirectory()) {
const buildhash = dirent.name;

const annotationFilepath = this.getAnnotationsFilepath(library, version, buildhash);
const infoFilepath = this.getConanInfoFilepath(library, version, buildhash);

const details = {
buildhash: buildhash,
annotation: await this.readAnnotationFromFile(annotationFilepath),
buildinfo: await this.readConanInfoFromFile(infoFilepath),
};

allAnnotations.push(details);
}
}
} catch (e) {
console.error(e);
}

return allAnnotations;
Expand Down

0 comments on commit 0144c71

Please sign in to comment.