addon/mg: Catch and report invalid_pbl_exception exceptions
This allows faulty .pbl files to be reported to the user in a clear fashion instead of presenting them as a "network communication error" (which is very wrong, seeing as how these issues only concern local files). The actual error is both logged in stderr and presented in the UI as in the following example: > Error > > A file with add-on publishing information could not be read. > > File: /home/shadowm/.wesnoth-1.11/data/add-ons/After_the_Storm.pbl > Error message: Unexpected characters after variable name (expected , or =), value '' at <unknown>:24
This commit is contained in:
parent
433a245266
commit
abcba170e4
3 changed files with 16 additions and 0 deletions
|
@ -1,4 +1,7 @@
|
|||
Version 1.11.6+dev:
|
||||
* Add-ons client:
|
||||
* Report errors caused by faulty local .pbl files properly instead of presenting
|
||||
them as network errors.
|
||||
* Language and i18n:
|
||||
* Updated translations: Lithuanian
|
||||
* Lua API:
|
||||
|
|
|
@ -3,6 +3,10 @@ changes may be omitted). For a complete list of changes, see the main
|
|||
changelog: https://github.com/wesnoth/wesnoth-old/blob/master/changelog
|
||||
|
||||
Version 1.11.6+dev:
|
||||
* Add-ons client:
|
||||
* Report errors caused by faulty local .pbl files properly instead of presenting
|
||||
them as network errors.
|
||||
|
||||
* Language and i18n:
|
||||
* Updated translations: Lithuanian.
|
||||
|
||||
|
|
|
@ -919,6 +919,15 @@ bool addons_manager_ui(display& disp, const std::string& remote_address)
|
|||
} catch(const io_exception& e) {
|
||||
ERR_FS << "io_exception thrown while installing an addon; \"" << e.what() << "\"\n";
|
||||
gui2::show_error_message(disp.video(), _("A problem occurred when trying to create the files necessary to install this add-on."));
|
||||
} catch(const invalid_pbl_exception& e) {
|
||||
ERR_CFG << "could not read .pbl file " << e.path << ": " << e.message << "\n";
|
||||
|
||||
utils::string_map symbols;
|
||||
symbols["path"] = e.path;
|
||||
symbols["msg"] = e.message;
|
||||
|
||||
gui2::show_error_message(disp.video(),
|
||||
vgettext("A local file with add-on publishing information could not be read.\n\nFile: $path\nError message: $msg", symbols));
|
||||
} catch(twml_exception& e) {
|
||||
e.show(disp);
|
||||
} catch(const addons_client::user_exit&) {
|
||||
|
|
Loading…
Add table
Reference in a new issue