DeviceSpec:parser: improve exception messages
This commit is contained in:
@@ -14,7 +14,9 @@ std::string DeviceManager::readDeviceFile(const std::string& filename)
|
|||||||
{
|
{
|
||||||
std::ifstream file(filename);
|
std::ifstream file(filename);
|
||||||
if (!file.is_open()) {
|
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(
|
std::string content(
|
||||||
@@ -46,11 +48,15 @@ void DeviceManager::parseAllDeviceSpecs(void)
|
|||||||
&fclose);
|
&fclose);
|
||||||
|
|
||||||
if (!input) {
|
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();
|
deviceSpeclin = input.get();
|
||||||
if (deviceSpecpparse()) {
|
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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user