Skip to content
Snippets Groups Projects
Commit 1ee2a993 authored by Riccardo Maria Bianchi's avatar Riccardo Maria Bianchi :sunny:
Browse files

throw exception if wrong variant data

parent 7befd726
Branches
No related tags found
1 merge request!317Modification of the way in which Shapes are persistified. New DB schema.
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#ifndef GEOMODELHELPERS_VARIANTHELPERS_H #ifndef GEOMODELHELPERS_VARIANTHELPERS_H
#define GEOMODELHELPERS_VARIANTHELPERS_H #define GEOMODELHELPERS_VARIANTHELPERS_H
#include "GeoModelHelpers/throwExcept.h"
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <vector> #include <vector>
...@@ -55,7 +57,7 @@ namespace GeoModelHelpers { ...@@ -55,7 +57,7 @@ namespace GeoModelHelpers {
} }
catch (std::bad_variant_access const &ex) 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; return ret;
} }
...@@ -70,7 +72,8 @@ namespace GeoModelHelpers { ...@@ -70,7 +72,8 @@ namespace GeoModelHelpers {
} }
catch (std::bad_variant_access const &ex) 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; return ret;
} }
...@@ -84,7 +87,7 @@ namespace GeoModelHelpers { ...@@ -84,7 +87,7 @@ namespace GeoModelHelpers {
} }
catch (std::bad_variant_access const &ex) 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; return ret;
} }
...@@ -113,7 +116,6 @@ namespace GeoModelHelpers { ...@@ -113,7 +116,6 @@ namespace GeoModelHelpers {
} else { } else {
type = "UNKOWN"; type = "UNKOWN";
} }
std::cout << "Variant is of type '" << type << "'" << std::endl;
return type; return type;
} }
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment