[f-spot] Don't crash in case of WebException
- From: Ruben Vermeersch <rubenv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [f-spot] Don't crash in case of WebException
- Date: Fri, 25 Jun 2010 14:15:44 +0000 (UTC)
commit c17f96b689415636d3e51602b169c4c86f313cdd
Author: Lorenzo Milesi <maxxer yetopen it>
Date: Tue Aug 11 23:11:34 2009 +0200
Don't crash in case of WebException
https://bugzilla.gnome.org/show_bug.cgi?id=553518
extensions/Exporters/FlickrExport/FlickrExport.cs | 15 +++++++++++++--
extensions/Exporters/FlickrExport/FlickrRemote.cs | 19 +++++++++++--------
2 files changed, 24 insertions(+), 10 deletions(-)
---
diff --git a/extensions/Exporters/FlickrExport/FlickrExport.cs b/extensions/Exporters/FlickrExport/FlickrExport.cs
index 2daab9c..680128c 100644
--- a/extensions/Exporters/FlickrExport/FlickrExport.cs
+++ b/extensions/Exporters/FlickrExport/FlickrExport.cs
@@ -230,6 +230,17 @@ namespace FSpotFlickrExport {
args.Auth = fr.CheckLogin ();
} catch (FlickrException e) {
args.Exception = e;
+ } catch (Exception e) {
+ HigMessageDialog md =
+ new HigMessageDialog (Dialog,
+ Gtk.DialogFlags.Modal |
+ Gtk.DialogFlags.DestroyWithParent,
+ Gtk.MessageType.Error, Gtk.ButtonsType.Ok,
+ Catalog.GetString ("Unable to log on"), e.Message);
+
+ md.Run ();
+ md.Destroy ();
+ return;
}
Gtk.Application.Invoke (this, args, delegate (object sender, EventArgs sargs) {
@@ -286,8 +297,8 @@ namespace FSpotFlickrExport {
fr = new FlickrRemote (token, current_service);
fr.TryWebLogin();
CurrentState = State.Connected;
- } catch (FlickrApiException e) {
- if (e.Code == 98) {
+ } catch (Exception e) {
+ if (e is FlickrApiException && (e as FlickrApiException).Code == 98) {
Logout ();
Login ();
} else {
diff --git a/extensions/Exporters/FlickrExport/FlickrRemote.cs b/extensions/Exporters/FlickrExport/FlickrRemote.cs
index 9c7bcfc..3e4ea96 100644
--- a/extensions/Exporters/FlickrExport/FlickrRemote.cs
+++ b/extensions/Exporters/FlickrExport/FlickrRemote.cs
@@ -67,7 +67,7 @@ public class FlickrRemote {
try {
licenses = flickr.PhotosLicensesGetInfo();
} catch (FlickrNet.FlickrApiException e ) {
- Log.Error ( e.Code + ": " + e.Verbose );
+ Log.Error (e.Code + ": " + e.Verbose );
return null;
}
}
@@ -104,12 +104,16 @@ public class FlickrRemote {
public Auth CheckLogin ()
{
- if (frob == null) {
- frob = flickr.AuthGetFrob ();
- if (frob == null) {
- Log.Error ("Problems login in Flickr. Don't have a frob");
- return null;
+ try {
+ if (frob == null) {
+ frob = flickr.AuthGetFrob ();
+ if (frob == null) {
+ Log.Error ("ERROR: Problems login in Flickr. Don't have a frob");
+ return null;
+ }
}
+ } catch (Exception e) {
+ Log.Error ("Error logging in: {0}", e.Message);
}
if (token == null) {
@@ -120,8 +124,7 @@ public class FlickrRemote {
return auth;
} catch (FlickrNet.FlickrApiException ex) {
- Log.Error ("Problems login in Flickr - "+ex.Verbose);
-
+ Log.Error ("Problems logging in to Flickr - " + ex.Verbose);
return null;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]