Commit 0251ec4d authored by Bryan Berthou's avatar Bryan Berthou
Browse files

refs#16

In ElementaryUtils (trunk) : in LoggerManager and PropertiesManager add more explicit error message.
parent afc9818c
......@@ -2,7 +2,9 @@
#include <SFML/System/Lock.hpp>
#include <SFML/System/Mutex.hpp>
//#include <iostream>
#include <stdexcept>
#include "../../include/ElementaryUtils/string_utils/Formatter.h"
namespace ElemUtils {
......@@ -37,7 +39,14 @@ PropertiesManager::~PropertiesManager() {
void PropertiesManager::init(const std::string &iniFilePath) {
sf::Lock lock(m_mutex); // mutex.lock()
m_iniFileParser.parse(iniFilePath);
try {
m_iniFileParser.parse(iniFilePath);
} catch (std::exception &e) {
throw std::runtime_error(
Formatter()
<< "(PropertiesManager::init) Cannot read ini file : "
<< iniFilePath << " " << e.what());
}
} // mutex.unlock()
//TODO voir à ajouter en parametre la valeur de retour par défaut dans le cas ou EMPTY est une valeur possible
......
......@@ -68,8 +68,8 @@ void LoggerManager::parseConfigurationFile(const std::string &filePath) {
} catch (std::exception &e) {
throw std::runtime_error(
Formatter()
<< "(LoggerManager::parseConfigurationFile) Cannot read logger.cfg file : "
<< e.what());
<< "(LoggerManager::parseConfigurationFile) Cannot read file : "
<< filePath << " " << e.what());
}
std::map<std::string, std::string> data = iniFileParser.getValues();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment