Always collect exceptions instead of swallowing them
This commit is contained in:
parent
5bf34b0db4
commit
f308216bbc
|
@ -73,7 +73,8 @@ namespace SparkleShare {
|
||||||
else
|
else
|
||||||
UpdateLabelEvent ("✓ You are running the latest version");
|
UpdateLabelEvent ("✓ You are running the latest version");
|
||||||
|
|
||||||
} catch {
|
} catch (Exception e) {
|
||||||
|
Logger.LogInfo ("UI", "Failed to download " + uri , e);
|
||||||
UpdateLabelEvent ("Couldn’t check for updates\t");
|
UpdateLabelEvent ("Couldn’t check for updates\t");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,8 +346,8 @@ namespace SparkleShare {
|
||||||
Logger.LogInfo ("Controller", "Added preset for " + uri.Host);
|
Logger.LogInfo ("Controller", "Added preset for " + uri.Host);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch {
|
} catch (Exception e) {
|
||||||
Logger.LogInfo ("Controller", "Failed adding preset for " + uri.Host);
|
Logger.LogInfo ("Controller", "Failed adding preset for " + uri.Host, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
using Gtk;
|
using Gtk;
|
||||||
|
using Sparkles;
|
||||||
|
|
||||||
namespace SparkleShare {
|
namespace SparkleShare {
|
||||||
|
|
||||||
|
@ -35,7 +36,9 @@ namespace SparkleShare {
|
||||||
try {
|
try {
|
||||||
return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback);
|
return icon_theme.LoadIcon (name, size, IconLookupFlags.GenericFallback);
|
||||||
|
|
||||||
} catch {
|
} catch (Exception e) {
|
||||||
|
Logger.LogInfo ("UI", "Failed to load icon " + name + " of size " + size, e);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return icon_theme.LoadIcon ("gtk-missing-image", size, IconLookupFlags.GenericFallback);
|
return icon_theme.LoadIcon ("gtk-missing-image", size, IconLookupFlags.GenericFallback);
|
||||||
|
|
||||||
|
|
|
@ -102,7 +102,8 @@ namespace Sparkles.Git {
|
||||||
string size = File.ReadAllText (file_path);
|
string size = File.ReadAllText (file_path);
|
||||||
return double.Parse (size);
|
return double.Parse (size);
|
||||||
|
|
||||||
} catch {
|
} catch (Exception e) {
|
||||||
|
Logger.LogInfo ("Git", Name + " | Failed to parse " + file_path, e);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +118,8 @@ namespace Sparkles.Git {
|
||||||
string size = File.ReadAllText (file_path);
|
string size = File.ReadAllText (file_path);
|
||||||
return double.Parse (size);
|
return double.Parse (size);
|
||||||
|
|
||||||
} catch {
|
} catch (Exception e) {
|
||||||
|
Logger.LogInfo ("Git", Name + " | Failed to parse " + file_path, e);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -638,16 +640,15 @@ namespace Sparkles.Git {
|
||||||
try {
|
try {
|
||||||
File.Move (local_file_path, target_file_path);
|
File.Move (local_file_path, target_file_path);
|
||||||
|
|
||||||
} catch {
|
} catch (Exception e) {
|
||||||
Logger.LogInfo ("Git",
|
string message = string.Format ("Failed to move \"{0}\" to \"{1}\"", local_file_path, target_file_path);
|
||||||
Name + " | Could not move \"" + local_file_path + "\" to \"" + target_file_path + "\"");
|
Logger.LogInfo ("Git", Name + " | " + message, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...and restore the most recent revision
|
// ...and restore the most recent revision
|
||||||
git = new GitCommand (LocalPath, "checkout " + CurrentRevision + " \"" + path + "\"");
|
git = new GitCommand (LocalPath, "checkout " + CurrentRevision + " \"" + path + "\"");
|
||||||
git.StartAndWaitForExit ();
|
git.StartAndWaitForExit ();
|
||||||
|
|
||||||
|
|
||||||
if (target_file_path.StartsWith (LocalPath))
|
if (target_file_path.StartsWith (LocalPath))
|
||||||
new Thread (() => OnFileActivity (null)).Start ();
|
new Thread (() => OnFileActivity (null)).Start ();
|
||||||
}
|
}
|
||||||
|
@ -966,8 +967,8 @@ namespace Sparkles.Git {
|
||||||
File.WriteAllText (Path.Combine (path, ".empty"), "I'm a folder!");
|
File.WriteAllText (Path.Combine (path, ".empty"), "I'm a folder!");
|
||||||
File.SetAttributes (Path.Combine (path, ".empty"), FileAttributes.Hidden);
|
File.SetAttributes (Path.Combine (path, ".empty"), FileAttributes.Hidden);
|
||||||
|
|
||||||
} catch {
|
} catch (Exception e) {
|
||||||
Logger.LogInfo ("Git", Name + " | Failed adding empty folder " + path);
|
Logger.LogInfo ("Git", Name + " | Failed adding empty folder " + path, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue