From 2377ee3c94116a1b41a553d08e330a5858a8d955 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20St=C3=B6sel?= Date: Thu, 5 Apr 2012 22:55:40 +0200 Subject: [PATCH] Display error dialog on external download failure --- extensions/external-download-manager.vala | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/extensions/external-download-manager.vala b/extensions/external-download-manager.vala index 62151dad..ba397c0f 100644 --- a/extensions/external-download-manager.vala +++ b/extensions/external-download-manager.vala @@ -113,6 +113,21 @@ namespace EDM { manager.deactivated (this); } + public void handle_exception (GLib.Error error) { + string ext_name; + this.get ("name",out ext_name); + var dialog = new MessageDialog (null, DialogFlags.MODAL, + MessageType.ERROR, ButtonsType.CLOSE, + _("An error occurred when attempting to download a file with the following plugin:\n" + + "%s\n\n" + + "Error:\n%s\n\n" + + "Carry on without this plugin." + ), + ext_name, error.message); + dialog.response.connect ((a) => { dialog.destroy (); }); + dialog.run (); + } + public abstract bool download (DownloadRequest dlReq); } @@ -146,7 +161,7 @@ namespace EDM { XMLRPC.parse_method_response ((string) message.response_body.flatten ().data, -1, out v); return true; } catch (Error e) { - stderr.printf ("Error while processing the response: %s\n", e.message); + this.handle_exception (e); } return false; @@ -174,7 +189,7 @@ namespace EDM { dm.AddFile (dlReq.uri); return true; } catch (Error e) { - stderr.printf("Error: %s\n", e.message); + this.handle_exception (e); } return false; } -- 2.39.5