@@ -638,15 +638,21 @@ auto DataPlugin::ReadCachedReadmeListing() -> readme_listing_type
638638{
639639 readme_listing_type cached_readme_listing;
640640
641- std::ifstream ss (cache.GetCachePath (" readme.ld" ), std::ios::binary);
642- if (ss.is_open ())
643- {
644- cereal::BinaryInputArchive archive (ss);
645- if (VerifyCachedReadme (ss, archive))
641+ try {
642+ std::ifstream ss (cache.GetCachePath (" readme.ld" ), std::ios::binary);
643+ if (ss.is_open ())
646644 {
647- block_reader listing_block (ss);
648- archive (cached_readme_listing);
645+ cereal::BinaryInputArchive archive (ss);
646+ if (VerifyCachedReadme (ss, archive))
647+ {
648+ block_reader listing_block (ss);
649+ archive (cached_readme_listing);
650+ }
649651 }
652+ } catch (const std::exception& e) {
653+ // TODO(#131): fix root cause of these exceptions
654+ this ->Log (" Error: Failed to read cached readme listing: %s" , e.what ());
655+ cached_readme_listing.clear ();
650656 }
651657 return cached_readme_listing;
652658}
@@ -659,16 +665,22 @@ auto DataPlugin::ReadCachedReadmeStore() -> readme_data_store
659665{
660666 readme_data_store store_lines;
661667
662- std::ifstream ss (cache.GetCachePath (" readme.ld" ), std::ios::binary);
663- if (ss.is_open ())
664- {
665- cereal::BinaryInputArchive archive (ss);
666- if (VerifyCachedReadme (ss, archive))
668+ try {
669+ std::ifstream ss (cache.GetCachePath (" readme.ld" ), std::ios::binary);
670+ if (ss.is_open ())
667671 {
668- block_reader::skip (ss); // skip listing block
669- block_reader lines_block (ss);
670- archive (store_lines);
672+ cereal::BinaryInputArchive archive (ss);
673+ if (VerifyCachedReadme (ss, archive))
674+ {
675+ block_reader::skip (ss); // skip listing block
676+ block_reader lines_block (ss);
677+ archive (store_lines);
678+ }
671679 }
680+ } catch (const std::exception& e) {
681+ // TODO(#131): fix root cause of these exceptions
682+ this ->Log (" Error: Failed to read cached readme store: %s" , e.what ());
683+ store_lines.clear ();
672684 }
673685 return store_lines;
674686}
0 commit comments