fix: improved GoosehintsModal error handling (#2932)

This commit is contained in:
Best Codes
2025-06-16 11:18:31 -05:00
committed by GitHub
parent af7918a794
commit 28b5e6b6fe
2 changed files with 5 additions and 2 deletions
@@ -106,9 +106,12 @@ export const GoosehintsModal = ({ directory, setIsGoosehintsModalOpen }: Goosehi
const { file, error, found } = await getGoosehintsFile(goosehintsFilePath);
setGoosehintsFile(file);
setGoosehintsFileFound(found);
setGoosehintsFileReadError(error || '');
// Only set error if file was found but there was an actual read error
// If file is not found, treat it as creating a new file (no error)
setGoosehintsFileReadError(found && error ? error : '');
} catch (error) {
console.error('Error fetching .goosehints file:', error);
setGoosehintsFileReadError('Failed to access .goosehints file');
}
};
if (directory) fetchGoosehintsFile();