impr: Show an error message when ImHex can't open a file (#1050)

This PR does two correlated things:

- Show a generic error message (Failed to open provider) rather than a
file-specific message (Failed to open file) when a provider fails to
open
- Set the error to something more specific when opening a file fails
This commit is contained in:
iTrooz
2023-04-30 18:37:22 +02:00
committed by GitHub
parent 1bdc1d7241
commit 13a3942f8f
4 changed files with 6 additions and 4 deletions

View File

@@ -180,7 +180,7 @@ namespace hex::plugin::builtin {
provider->loadSettings(recentProvider.data);
if (!provider->open() || !provider->isAvailable()) {
PopupError::open("hex.builtin.popup.error.open"_lang);
PopupError::open(hex::format("hex.builtin.provider.error.open"_lang, provider->getErrorMessage()));
TaskManager::doLater([provider] { ImHexApi::Provider::remove(provider); });
return;
}