Browse Source

Better error message in ValueParser

tempestpy_adaptions
Matthias Volk 7 years ago
parent
commit
8eb16634c1
  1. 9
      src/storm/parser/ValueParser.cpp

9
src/storm/parser/ValueParser.cpp

@ -1,6 +1,7 @@
#include "storm/parser/ValueParser.h"
#include "storm/exceptions/NotSupportedException.h"
#include "storm/exceptions/WrongFormatException.h"
namespace storm {
namespace parser {
@ -12,7 +13,6 @@ namespace storm {
template<>
void ValueParser<storm::RationalFunction>::addParameter(std::string const& parameter) {
//STORM_LOG_THROW((std::is_same<ValueType, storm::RationalFunction>::value), storm::exceptions::NotSupportedException, "Parameters only allowed when using rational functions.");
storm::expressions::Variable var = manager->declareRationalVariable(parameter);
identifierMapping.emplace(var.getName(), var);
parser.setIdentifierMapping(identifierMapping);
@ -21,7 +21,12 @@ namespace storm {
template<>
double ValueParser<double>::parseValue(std::string const& value) const {
return boost::lexical_cast<double>(value);
try {
return boost::lexical_cast<double>(value);
}
catch(boost::bad_lexical_cast &) {
STORM_LOG_THROW(false, storm::exceptions::WrongFormatException, "Could not parse value '" << value << "'.");
}
}
template<>

Loading…
Cancel
Save