Skip to content

Commit fac6825

Browse files
committed
Improvements to error reporter
1 parent 2d72645 commit fac6825

1 file changed

Lines changed: 31 additions & 5 deletions

File tree

src/UniGetUI.Core.Tools/Tools.cs

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,20 +195,46 @@ public static void ReportFatalException(Exception e)
195195
}
196196

197197
string Error_String = $@"
198-
OS: {Environment.OSVersion.Platform}
199-
Version: {Environment.OSVersion.VersionString}
200-
OS Architecture: {Environment.Is64BitOperatingSystem}
201-
APP Architecture: {Environment.Is64BitProcess}
198+
Windows version: {Environment.OSVersion.VersionString}
202199
Language: {LangName}
203200
APP Version: {CoreData.VersionName}
201+
APP Build number: {CoreData.BuildNumber}
204202
Executable: {Environment.ProcessPath}
205203
206-
Crash HResult: {(uint)e.HResult}
204+
Crash HResult: 0x{(uint)e.HResult:X} ({(uint)e.HResult}, {e.HResult})
207205
Crash Message: {e.Message}
208206
209207
Crash Traceback:
210208
{e.StackTrace}";
211209

210+
try
211+
{
212+
int i = 0;
213+
while (e.InnerException is not null)
214+
{
215+
i++;
216+
e = e.InnerException;
217+
Error_String += $@"
218+
219+
220+
---------------------
221+
Inner exception ({i}):
222+
Crash HResult: 0x{(uint)e.HResult:X} ({(uint)e.HResult}, {e.HResult})
223+
Crash Message: {e.Message}
224+
225+
Crash Traceback:
226+
{e.StackTrace}";
227+
}
228+
229+
if (i == 0)
230+
{
231+
Error_String += $"\n\n\nNo inner exceptions found";
232+
}
233+
} catch
234+
{
235+
// ignore
236+
}
237+
212238
Console.WriteLine(Error_String);
213239

214240
string ErrorBody = "https://www.marticliment.com/error-report/?appName=UniGetUI^&errorBody=" +

0 commit comments

Comments
 (0)