Browse Source

Handle exceptions in ICSharpCode.Svn.HistoryViewPanel.GetLogMessages

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@520 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 21 years ago
parent
commit
56f0ee8610
  1. 13
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewPanel.cs
  2. 19
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs
  3. 29
      src/Main/StartUp/Project/Dialogs/ExceptionBox.cs

13
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/HistoryViewPanel.cs

@ -17,7 +17,7 @@ using NSvn.Core;
namespace ICSharpCode.Svn namespace ICSharpCode.Svn
{ {
/// <summary> /// <summary>
/// Description of HistoryViewPanel. /// The panel in the "history" secondary viewcontent. Contains a tabcontol.
/// </summary> /// </summary>
public class HistoryViewPanel : Panel public class HistoryViewPanel : Panel
{ {
@ -88,14 +88,19 @@ namespace ICSharpCode.Svn
} }
} catch (Exception ex) { } catch (Exception ex) {
// if exceptions aren't caught here, they force SD to exit // if exceptions aren't caught here, they force SD to exit
MessageService.ShowError(ex); if (ex is SvnClientException || ex is System.Runtime.InteropServices.SEHException) {
LoggingService.Warn(ex);
WorkbenchSingleton.SafeThreadAsyncCall(infoPanel, "ShowError", ex);
} else {
MessageService.ShowError(ex);
}
} }
} }
void ReceiveLogMessage(LogMessage logMessage) void ReceiveLogMessage(LogMessage logMessage)
{ {
WorkbenchSingleton.SafeThreadCall(infoPanel, "AddLogMessage", logMessage); WorkbenchSingleton.SafeThreadAsyncCall(infoPanel, "AddLogMessage", logMessage);
WorkbenchSingleton.SafeThreadCall(diffPanel, "AddLogMessage", logMessage); WorkbenchSingleton.SafeThreadAsyncCall(diffPanel, "AddLogMessage", logMessage);
} }
} }
} }

19
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/HistoryViewDisplayBinding/InfoPanel.cs

@ -42,6 +42,25 @@ namespace ICSharpCode.Svn
ControlDictionary["splitter1"].Height = 3; ControlDictionary["splitter1"].Height = 3;
} }
public void ShowError(Exception ex)
{
TextBox txt = new TextBox();
txt.Multiline = true;
txt.ReadOnly = true;
txt.BackColor = SystemColors.Window;
SvnClientException svn;
txt.Text = "";
while ((svn = ex as SvnClientException) != null) {
txt.Text += svn.SvnError + Environment.NewLine;
ex = svn.InnerException;
}
if (ex != null) {
txt.Text += ex.ToString();
}
txt.Dock = DockStyle.Fill;
revisionList.Controls.Add(txt);
}
int lastRevision = -1; int lastRevision = -1;
public void AddLogMessage(LogMessage logMessage) public void AddLogMessage(LogMessage logMessage)

29
src/Main/StartUp/Project/Dialogs/ExceptionBox.cs

@ -91,16 +91,31 @@ namespace ICSharpCode.SharpDevelop
int result = MessageService.ShowCustomDialog("SharpDevelop", text, int result = MessageService.ShowCustomDialog("SharpDevelop", text,
"Join the list", "Write mail", "Cancel"); "Join the list", "Write mail", "Cancel");
if (result == 0) { if (result == 0) {
try { StartUrl("http://www.glengamoi.com/mailman/listinfo/icsharpcode.svn-sharpdevelop-users");
Process.Start("http://www.glengamoi.com/mailman/listinfo/icsharpcode.svn-sharpdevelop-users");
} catch {}
} else if (result == 1) { } else if (result == 1) {
// clipboard text is too long to be inserted into the mail-url // clipboard text is too long to be inserted into the mail-url
string url = "mailto:icsharpcode.svn-sharpdevelop-users@glengamoi.com?subject=Bug Report&body=" string exceptionTitle = "";
Exception ex = exceptionThrown;
if (ex != null) {
try {
while (ex.InnerException != null) ex = ex.InnerException;
exceptionTitle = " (" + ex.GetType().Name + ")";
} catch {}
}
string url = "mailto:icsharpcode.svn-sharpdevelop-users@glengamoi.com?subject=Bug Report"
+ Uri.EscapeDataString(exceptionTitle)
+ "&body="
+ Uri.EscapeDataString("Write an English description on how to reproduce the error and paste the exception text."); + Uri.EscapeDataString("Write an English description on how to reproduce the error and paste the exception text.");
try { StartUrl(url);
Process.Start(url); }
} catch {} }
static void StartUrl(string url)
{
try {
Process.Start(url);
} catch (Exception e) {
LoggingService.Warn("Cannot start " + url, e);
} }
} }

Loading…
Cancel
Save