Skip to content

Commit f0aeb0d

Browse files
committed
Improve exception message display
1 parent c034794 commit f0aeb0d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

IPConfig/App.xaml.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -153,17 +153,20 @@ private static async void ShowUnhandledExceptionAsync(Exception exception, strin
153153
logStatus = Lang.LoggingFailed;
154154
}
155155

156-
var sb = new StringBuilder($"{Lang.AppCrashed}\n\n[{source}]\n{exception.Message}\n\n{logStatus}");
156+
var sb = new StringBuilder($"{Lang.AppCrashed}\n\n[{source}]\n{exception.Message}\n");
157+
158+
int indent = 0;
157159

158160
var innerEx = exception.InnerException;
159161

160162
while (innerEx is not null)
161163
{
162-
sb.AppendLine(new string('-', 16));
163-
sb.AppendLine(innerEx.Message);
164+
sb.AppendLine($"{new string(' ', indent)}└── {innerEx.Message}");
164165
innerEx = innerEx.InnerException;
166+
indent += 4;
165167
}
166168

169+
sb.Append($"\n{logStatus}");
167170
string msg = sb.ToString();
168171

169172
// 窗口未处于活动状态可能导致 Growl 不显示。

0 commit comments

Comments
 (0)