mirror of
https://github.com/4sval/FModel.git
synced 2026-03-21 17:24:26 -05:00
reworked how exceptions were displayed
This commit is contained in:
parent
61c1c67733
commit
f8e929b347
|
|
@ -1 +1 @@
|
|||
Subproject commit 0a91f0da6103d2f8c35f5a586b0aac6b40f9bd0b
|
||||
Subproject commit 92d575d4eac879cca8cfeed6fa8401ede1913750
|
||||
|
|
@ -10,17 +10,18 @@ public static class Constants
|
|||
public static readonly FGuid ZERO_GUID = new(0U);
|
||||
|
||||
public const string WHITE = "#DAE5F2";
|
||||
public const string GRAY = "#BBBBBB";
|
||||
public const string RED = "#E06C75";
|
||||
public const string GREEN = "#98C379";
|
||||
public const string YELLOW = "#E5C07B";
|
||||
public const string BLUE = "#528BCC";
|
||||
|
||||
public const string ISSUE_LINK = "https://github.com/iAmAsval/FModel/issues/new/choose";
|
||||
public const string DONATE_LINK = "https://fmodel.app/donate";
|
||||
public const string DISCORD_LINK = "https://fmodel.app/discord";
|
||||
public const string DONATE_LINK = "https://fmodel.app/donate?utm_source=fmodel&utm_medium=app&utm_campaign=donations";
|
||||
public const string DISCORD_LINK = "https://fmodel.app/discord?utm_source=fmodel&utm_medium=app&utm_campaign=discord-server";
|
||||
|
||||
public const string _FN_LIVE_TRIGGER = "fortnite-live.manifest";
|
||||
public const string _VAL_LIVE_TRIGGER = "valorant-live.manifest";
|
||||
|
||||
public const string _NO_PRESET_TRIGGER = "Hand Made";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using FModel.Extensions;
|
||||
using FModel.Framework;
|
||||
using FModel.Services;
|
||||
using FModel.Views.Resources.Controls;
|
||||
|
|
@ -41,6 +41,10 @@ public class ThreadWorkerViewModel : ViewModel
|
|||
|
||||
private ApplicationViewModel _applicationView => ApplicationService.ApplicationView;
|
||||
private readonly AsyncQueue<Action<CancellationToken>> _jobs;
|
||||
private const string _at = " at ";
|
||||
private const char _dot = '.';
|
||||
private const char _colon = ':';
|
||||
private const string _gray = "#999";
|
||||
|
||||
public ThreadWorkerViewModel()
|
||||
{
|
||||
|
|
@ -99,8 +103,32 @@ public class ThreadWorkerViewModel : ViewModel
|
|||
Log.Error("{Exception}", e);
|
||||
|
||||
FLogger.AppendError();
|
||||
FLogger.AppendText(e.Message, Constants.WHITE, true);
|
||||
FLogger.AppendText(" " + e.StackTrace.SubstringBefore('\n').Trim(), Constants.WHITE, true);
|
||||
if ((e.InnerException ?? e) is { TargetSite.DeclaringType: not null } exception)
|
||||
{
|
||||
if (exception.TargetSite.ToString() == "CUE4Parse.FileProvider.GameFile get_Item(System.String)")
|
||||
{
|
||||
FLogger.AppendText(e.Message, Constants.WHITE, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
var t = exception.GetType();
|
||||
FLogger.AppendText(t.Namespace + _dot, Constants.GRAY);
|
||||
FLogger.AppendText(t.Name, Constants.WHITE);
|
||||
FLogger.AppendText(_colon + " ", Constants.GRAY);
|
||||
FLogger.AppendText(exception.Message, Constants.RED, true);
|
||||
|
||||
FLogger.AppendText(_at, _gray);
|
||||
FLogger.AppendText(exception.TargetSite.DeclaringType.FullName + _dot, Constants.GRAY);
|
||||
FLogger.AppendText(exception.TargetSite.Name, Constants.YELLOW);
|
||||
|
||||
var parameters = new StringBuilder();
|
||||
foreach (var parameter in exception.TargetSite.GetParameters())
|
||||
{
|
||||
parameters.Append(parameter.ParameterType.Name + " " + parameter.Name);
|
||||
}
|
||||
FLogger.AppendText("(" + string.Join(", ", parameters) + ")", Constants.GRAY, true);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -115,4 +143,4 @@ public class ThreadWorkerViewModel : ViewModel
|
|||
StatusChangeAttempted = true;
|
||||
StatusChangeAttempted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user