diff --git a/src/limestone/rotation_task.cpp b/src/limestone/rotation_task.cpp index d1b289c2..1e433b8c 100644 --- a/src/limestone/rotation_task.cpp +++ b/src/limestone/rotation_task.cpp @@ -70,13 +70,16 @@ void rotation_task::rotate() { boost::system::error_code error; bool result = boost::filesystem::exists(lc->file_path(), error); if (error) { - LOG_LP(ERROR) << "Failed to check if file exists: " << lc->file_path() << ", error_code: " << error.message(); - throw std::runtime_error("Failed to check if file exists: " + lc->file_path().string()); - } - if (!result) { - LOG_LP(INFO) << "File does not exist, skipping: " << lc->file_path(); - continue; // skip if file does not exist + if (error == boost::system::errc::no_such_file_or_directory || !result) { + LOG_LP(INFO) << "File does not exist, skipping: " << lc->file_path(); + continue; + } else { + // For any other errors + LOG_LP(ERROR) << "Failed to check if file exists: " << lc->file_path() << ", error_code: " << error.message(); + throw std::runtime_error("Failed to check if file exists: " + lc->file_path().string()); + } } + // The following code may seem necessary at first glance, but there is a possibility // that files could be appended to before the rotation is complete. // In that case, skipping them could result in missing files that should be processed.