Added exceptions

dev v0.1_beta
marcelb 2 years ago
parent e4bde2e783
commit 1a84ca7109
  1. 3
      .vscode/settings.json
  2. 8
      src/config.cpp

@ -2,6 +2,7 @@
"files.associations": {
"*.tcc": "cpp",
"compare": "cpp",
"type_traits": "cpp"
"type_traits": "cpp",
"iostream": "cpp"
}
}

@ -4,12 +4,10 @@
config::config(const string _configFilePath, const vector<string> _necessary) {
necessary = _necessary;
if(!init(_configFilePath)) {
cout << "ERROR init config file" << endl;
exit(1);
throw "[ERROR] Init config file ";
}
if (!isHaveNecessary()) {
cout << "ERROR Konfiguracijska datoteka nema sva nužna polja!" << endl;
exit(2);
throw "[ERROR] Configuration file does not have all the required fields ";
}
}
@ -23,7 +21,7 @@ bool config::init(const string _configFilePath) {
ifstream configFile;
configFile.open(_configFilePath, ios::in);
if(!configFile) {
printf ("[CRITICAL ERROR] Nema konfiguracijske datoteke!");
//printf ("[CRITICAL ERROR] Nema konfiguracijske datoteke!");
return false;
}

Loading…
Cancel
Save