Improved error handling when opening files

This commit is contained in:
Jan Käberich 2021-10-12 20:52:11 +02:00
parent 63cb5e4f67
commit e4106fe3a2
3 changed files with 18 additions and 3 deletions

View file

@ -178,7 +178,12 @@ AppWindow::AppWindow(QWidget *parent)
return;
}
nlohmann::json j;
file >> j;
try {
file >> j;
} catch (exception &e) {
QMessageBox::warning(nullptr, "Error", "Failed to parse the setup file (" + QString(e.what()) + ")");
qWarning() << "Parsing of setup file failed: " << e.what();
}
file.close();
LoadSetup(j);
});