refactor: add error handling to component import

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2023-01-25 10:43:23 +01:00
parent cd893e18d2
commit 199a7df807
3 changed files with 35 additions and 32 deletions

View File

@ -384,8 +384,12 @@ void VersionPage::on_actionImport_Components_triggered()
QStringList list = GuiUtil::BrowseForFiles("component", tr("Select components"), tr("Components (*.json)"),
APPLICATION->settings()->get("CentralModsDir").toString(), this->parentWidget());
if (!list.isEmpty())
m_profile->installComponents(list);
if (!list.isEmpty()) {
if (!m_profile->installComponents(list)) {
QMessageBox::warning(this, tr("Failed to import components"),
tr("Some components could not be imported. Check logs for details"));
}
}
updateButtons();
}