fix(core): only suppress ENOENT in loadPlan, rethrow other errors

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
wenshao 2026-04-06 18:05:36 +08:00
parent 7a2f5887b9
commit e038ce9958
2 changed files with 24 additions and 3 deletions

View file

@ -1690,8 +1690,16 @@ export class Config {
const filePath = this.getPlanFilePath();
try {
return fs.readFileSync(filePath, 'utf-8');
} catch {
return undefined;
} catch (error: unknown) {
if (
typeof error === 'object' &&
error !== null &&
'code' in error &&
(error as NodeJS.ErrnoException).code === 'ENOENT'
) {
return undefined;
}
throw error;
}
}