DeviceSpec:parser: improve exception messages

This commit is contained in:
2025-01-08 11:46:59 -04:00
parent 5a5e2fa25f
commit f5e3986644
+9 -3
View File
@@ -14,7 +14,9 @@ std::string DeviceManager::readDeviceFile(const std::string& filename)
{
std::ifstream file(filename);
if (!file.is_open()) {
throw std::runtime_error("Could not open file: " + filename);
throw std::runtime_error(
std::string(__func__) + ": Couldn't open deviceSpec file: "
+ filename);
}
std::string content(
@@ -46,11 +48,15 @@ void DeviceManager::parseAllDeviceSpecs(void)
&fclose);
if (!input) {
throw std::runtime_error("Failed to open memory as file");
throw std::runtime_error(
std::string(__func__) + ": Failed to fmemopen() a FILE* for "
"parsing device specs");
}
deviceSpeclin = input.get();
if (deviceSpecpparse()) {
throw std::runtime_error("Failed to parse device specs");
throw std::runtime_error(
std::string(__func__) + ": Failed to parse device specs. "
"Check specs for errors");
}
}