avoid exceptions #447

Merged
meggert merged 2 commits from bugfix_create_dir_no_exceptions into develop 2023-03-08 15:07:57 +01:00
2 changed files with 4 additions and 4 deletions
Showing only changes of commit 2dd97a55f8 - Show all commits

View File

@ -1205,7 +1205,8 @@ void CoreController::performMountedSdCardOperations() {
if (not std::filesystem::exists(path.str()), e) { if (not std::filesystem::exists(path.str()), e) {
bool created = std::filesystem::create_directory(path.str(), e); bool created = std::filesystem::create_directory(path.str(), e);
if (not created) { if (not created) {
sif::error << "Could not create CONF folder at " << path << ": " << e << std::endl; sif::error << "Could not create CONF folder at " << path.str() << ": " << e.message()
<< std::endl;
return; return;
} }
} }
@ -1897,7 +1898,6 @@ ReturnValue_t CoreController::executeSwUpdate(SwUpdateSources sourceDir, const u
utility::handleSystemError(result, "CoreController::executeAction: SW Update Decompression"); utility::handleSystemError(result, "CoreController::executeAction: SW Update Decompression");
} }
path strippedImagePath = prefixPath / path(config::STRIPPED_OBSW_BINARY_FILE_NAME); path strippedImagePath = prefixPath / path(config::STRIPPED_OBSW_BINARY_FILE_NAME);
std::error_code e;
if (!exists(strippedImagePath, e)) { if (!exists(strippedImagePath, e)) {
// TODO: Custom returnvalue? // TODO: Custom returnvalue?
return returnvalue::FAILED; return returnvalue::FAILED;

View File

@ -16,8 +16,8 @@ ReturnValue_t NVMParameterBase::readJsonFile() {
std::ifstream i(fullName); std::ifstream i(fullName);
try { try {
i >> json; i >> json;
} catch (nlohmann::json::exception& e) { } catch (nlohmann::json::exception& nlohmannE) {
sif::warning << "Reading JSON file failed with error " << e.what() << std::endl; sif::warning << "Reading JSON file failed with error " << nlohmannE.what() << std::endl;
return returnvalue::FAILED; return returnvalue::FAILED;
} }
return returnvalue::OK; return returnvalue::OK;