@@ -69,28 +69,35 @@ void Cache::cacheConfigFile(const std::string& configId, const std::string& uri,
6969 if (CachePath.empty ())
7070 return ;
7171
72- std::unique_lock<std::mutex> lock (CacheMutex);
72+ try
73+ {
74+ std::unique_lock<std::mutex> lock (CacheMutex);
7375
74- Poco::Path rootPath (CachePath, Uri::encode (configId));
75- rootPath.makeDirectory ();
76+ Poco::Path rootPath (CachePath, Uri::encode (configId));
77+ rootPath.makeDirectory ();
7678
77- Poco::Path cachePath (rootPath, Uri::encode (uri));
78- cachePath.makeDirectory ();
79+ Poco::Path cachePath (rootPath, Uri::encode (uri));
80+ cachePath.makeDirectory ();
7981
80- Poco::File (cachePath).createDirectories ();
82+ Poco::File (cachePath).createDirectories ();
8183
82- std::string cacheFileDir = cachePath.toString ();
83- std::string cacheFile = Poco::Path (cacheFileDir, " contents" ).toString ();
84+ std::string cacheFileDir = cachePath.toString ();
85+ std::string cacheFile = Poco::Path (cacheFileDir, " contents" ).toString ();
8486
85- FileUtil::copyFileTo (filename, cacheFile);
87+ FileUtil::copyFileTo (filename, cacheFile);
8688
87- std::ofstream cacheStamp (Poco::Path (cacheFileDir, " stamp" ).toString ());
88- cacheStamp << stamp << ' \n ' ;
89- cacheStamp.close ();
89+ std::ofstream cacheStamp (Poco::Path (cacheFileDir, " stamp" ).toString ());
90+ cacheStamp << stamp << ' \n ' ;
91+ cacheStamp.close ();
9092
91- updateLastUsed (rootPath.toString ());
93+ updateLastUsed (rootPath.toString ());
9294
93- clearOutdatedConfigs ();
95+ clearOutdatedConfigs ();
96+ }
97+ catch (const std::exception& exc)
98+ {
99+ LOG_ERR (" Error while caching: " << filename << " of: " << exc.what ());
100+ }
94101}
95102
96103void Cache::updateLastUsed (const std::string& path)
0 commit comments