avoid exceptions
Some checks failed
EIVE/eive-obsw/pipeline/head There was a failure building this commit
EIVE/eive-obsw/pipeline/pr-develop There was a failure building this commit

This commit is contained in:
2023-03-08 14:50:25 +01:00
parent 0bdc6d3d7c
commit ccf03b131b
19 changed files with 83 additions and 45 deletions

View File

@ -1 +1 @@
target_sources(${LIB_EIVE_MISSION} PRIVATE NVMParameterBase.cpp)
target_sources(${LIB_EIVE_MISSION} PRIVATE NvmParameterBase.cpp)

View File

@ -1,4 +1,4 @@
#include "NVMParameterBase.h"
#include <mission/memory/NvmParameterBase.h>
#include <fstream>
@ -10,7 +10,8 @@ NVMParameterBase::NVMParameterBase(std::string fullName) : fullName(fullName) {}
NVMParameterBase::NVMParameterBase() {}
ReturnValue_t NVMParameterBase::readJsonFile() {
if (std::filesystem::exists(fullName)) {
std::error_code e;
if (std::filesystem::exists(fullName, e)) {
// Read JSON file content into object
std::ifstream i(fullName);
try {
@ -39,7 +40,10 @@ void NVMParameterBase::setFullName(std::string fullName) { this->fullName = full
std::string NVMParameterBase::getFullName() const { return fullName; }
bool NVMParameterBase::getJsonFileExists() { return std::filesystem::exists(fullName); }
bool NVMParameterBase::getJsonFileExists() {
std::error_code e;
return std::filesystem::exists(fullName, e);
}
void NVMParameterBase::printKeys() const {
sif::info << "Printing keys for JSON file " << fullName << std::endl;