mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-30 09:26:15 +02:00
catch config parse errors
This commit is contained in:
parent
5fae6e85f7
commit
bfdca3038d
1 changed files with 19 additions and 12 deletions
|
@ -20,7 +20,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include "common/log.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -32,6 +32,8 @@ Config::Config()
|
||||||
filename_ = dir + "settings.json";
|
filename_ = dir + "settings.json";
|
||||||
cerr << filename_ << "\n";
|
cerr << filename_ << "\n";
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
ifstream ifs(filename_, std::ifstream::in);
|
ifstream ifs(filename_, std::ifstream::in);
|
||||||
if (ifs.good())
|
if (ifs.good())
|
||||||
{
|
{
|
||||||
|
@ -47,6 +49,11 @@ Config::Config()
|
||||||
std::cout << "Client:\n" << std::setw(4) << client->toJson() << '\n';
|
std::cout << "Client:\n" << std::setw(4) << client->toJson() << '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch(const std::exception& e)
|
||||||
|
{
|
||||||
|
logE << "Error reading config: " << e.what() << "\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue