Skip to content
Snippets Groups Projects
Commit 3efb2c9b authored by Riccardo Maria Bianchi's avatar Riccardo Maria Bianchi :sunny: Committed by Johannes Junggeburth
Browse files

throw exception if wrong variant data

parent 7a261c8b
No related branches found
No related tags found
1 merge request!327New schema for the GeoModel SQLite database and updated I/O
......@@ -12,6 +12,8 @@
#ifndef GEOMODELHELPERS_VARIANTHELPERS_H
#define GEOMODELHELPERS_VARIANTHELPERS_H
#include "GeoModelHelpers/throwExcept.h"
#include <iostream>
#include <string>
#include <vector>
......@@ -55,7 +57,7 @@ namespace GeoModelHelpers {
}
catch (std::bad_variant_access const &ex)
{
std::cout << ex.what() << ": '" << logMsg << "' is not a 'string'! " << getFromVariant_Type(record) << "\n";
THROW_EXCEPTION(std::string(ex.what()) + ": '" + std::string(logMsg) + "' is not a '" + std::string(type) + "'! It's a '" + getFromVariant_Type(record) + "'.");
}
return ret;
}
......@@ -70,7 +72,8 @@ namespace GeoModelHelpers {
}
catch (std::bad_variant_access const &ex)
{
std::cout << ex.what() << ": '" << logMsg << "' is not a '" << type << "'! " << getFromVariant_Type(record) << "\n";
THROW_EXCEPTION(std::string(ex.what()) + ": '" + std::string(logMsg) + "' is not a '" + std::string(type) + "'! It's a '" + getFromVariant_Type(record) + "'.");
}
return ret;
}
......@@ -84,7 +87,7 @@ namespace GeoModelHelpers {
}
catch (std::bad_variant_access const &ex)
{
std::cout << ex.what() << ": '" << logMsg << "' is not a '" << type << "'! " << getFromVariant_Type(record) << "\n";
THROW_EXCEPTION(std::string(ex.what()) + ": '" + std::string(logMsg) + "' is not a '" + std::string(type) + "'! It's a '" + getFromVariant_Type(record) + "'.");
}
return ret;
}
......@@ -113,7 +116,6 @@ namespace GeoModelHelpers {
} else {
type = "UNKOWN";
}
std::cout << "Variant is of type '" << type << "'" << std::endl;
return type;
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment