Graceful failing on missing data
This commit is contained in:
@@ -4,13 +4,15 @@ DescriptorManager::DescriptorManager() {} //don't use this
|
||||
DescriptorManager::DescriptorManager(const fs::path & image_path) {
|
||||
img_path = image_path;
|
||||
if (!fs::exists(img_path)) {
|
||||
cout << "Error. Data folder not found." << endl;
|
||||
return; //No data: giving up.
|
||||
throw std::invalid_argument("Data missing");
|
||||
}
|
||||
numImages = std::count_if(
|
||||
fs::directory_iterator(img_path),
|
||||
fs::directory_iterator(),
|
||||
static_cast<bool(*)(const fs::path&)>(fs::is_regular_file));
|
||||
if (numImages <= 0) {
|
||||
throw std::invalid_argument("Data missing");
|
||||
}
|
||||
current_image = NULL;
|
||||
//Manual definitions.. SAD!
|
||||
descriptor_types[7] = new DCTMedian();
|
||||
|
||||
Reference in New Issue
Block a user