Skip to content

Commit 8276615

Browse files
authored
merging changed to runtime_error for XML configuration errors (#784)
1 parent bfd7093 commit 8276615

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@ cmake-build-*/
99

1010
# Visual Studio Code
1111
.vscode/
12+
.clj-kondo/
13+
.lsp/
1214

13-
CMakeUserPresets.json
15+
CMakeUserPresets.json

src/cosim/osp_config_parser.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ bool osp_config_parser::parse_boolean_value(const std::string& s)
591591
iss.clear();
592592
iss >> std::boolalpha >> bool_value;
593593
if (iss.fail()) {
594-
throw std::invalid_argument("Value: '" + s + "' is not convertable to bool");
594+
throw std::runtime_error("Value: '" + s + "' is not convertable to bool");
595595
}
596596
}
597597

@@ -675,7 +675,7 @@ osp_config_parser::SignalConnection find_signal_connection(
675675
if (it == signalConnections.end()) {
676676
std::ostringstream oss;
677677
oss << "Missing expected connection to " << functionName << ":" << signalName;
678-
throw std::out_of_range(oss.str());
678+
throw std::runtime_error(oss.str());
679679
}
680680
return *it;
681681
}
@@ -713,7 +713,7 @@ extended_model_description get_emd(
713713
if (emdIt == emds.end()) {
714714
std::ostringstream oss;
715715
oss << "Cannot find extended model description for " << element;
716-
throw std::out_of_range(oss.str());
716+
throw std::runtime_error(oss.str());
717717
}
718718
return emdIt->second;
719719
}
@@ -939,14 +939,14 @@ osp_config load_osp_config(
939939
std::ostringstream oss;
940940
oss << "Configured base step size [" << simInfo.stepSize << "] must be nonzero and positive";
941941
BOOST_LOG_SEV(log::logger(), log::error) << oss.str();
942-
throw std::invalid_argument(oss.str());
942+
throw std::runtime_error(oss.str());
943943
}
944944

945945
if (simInfo.endTime.has_value() && simInfo.startTime > simInfo.endTime.value()) {
946946
std::ostringstream oss;
947947
oss << "Configured start time [" << simInfo.startTime << "] is larger than configured end time [" << simInfo.endTime.value() << "]";
948948
BOOST_LOG_SEV(log::logger(), log::error) << oss.str();
949-
throw std::invalid_argument(oss.str());
949+
throw std::runtime_error(oss.str());
950950
}
951951

952952
osp_config config;

0 commit comments

Comments
 (0)