Skip to content

Commit a77daa3

Browse files
authored
fix: Only log manifest read/parse errors after 3 consecutive failures (#1583)
1 parent 651338c commit a77daa3

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ test-workspace/
3535
.Spotlight-V100
3636
.Trashes
3737
ehthumbs.db
38-
Thumbs.db
38+
Thumbs.db
39+
.aider*

src/manifest/parsers/index.ts

+12-6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { MetricParser } from "./metricParser";
1818
@provide(ManifestParser)
1919
export class ManifestParser {
2020
private lastSentParseManifestProps: any;
21+
private consecutiveReadFailures = 0;
2122

2223
constructor(
2324
private nodeParser: NodeParser,
@@ -200,13 +201,18 @@ export class ManifestParser {
200201

201202
try {
202203
const manifestFile = readFileSync(manifestLocation, "utf8");
203-
return JSON.parse(manifestFile);
204+
const parsedManifest = JSON.parse(manifestFile);
205+
this.consecutiveReadFailures = 0; // Reset counter on success
206+
return parsedManifest;
204207
} catch (error) {
205-
this.terminal.error(
206-
"ManifestParser",
207-
`Could not read manifest file at ${manifestLocation}, ignoring error`,
208-
error,
209-
);
208+
this.consecutiveReadFailures++;
209+
if (this.consecutiveReadFailures > 3) {
210+
this.terminal.error(
211+
"ManifestParser",
212+
`Could not read/parse manifest file at ${manifestLocation} after ${this.consecutiveReadFailures} attempts`,
213+
error,
214+
);
215+
}
210216
}
211217
}
212218
}

0 commit comments

Comments
 (0)