mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-19 16:33:36 +03:00
change: log result stacktrace instead of asserting
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
aa860b2fc4
commit
5f007ada74
1 changed files with 12 additions and 2 deletions
|
@ -58,7 +58,7 @@ public sealed class Profiler
|
|||
/// <returns>The original result.</returns>
|
||||
public Result PopWithResult(Result result)
|
||||
{
|
||||
Debug.Assert(result.IsSuccess);
|
||||
LogResultStackTrace(result);
|
||||
Pop();
|
||||
return result;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public sealed class Profiler
|
|||
/// <returns>The original result.</returns>
|
||||
public Result ReportWithResult(Result result)
|
||||
{
|
||||
Debug.Assert(result.IsSuccess);
|
||||
LogResultStackTrace(result);
|
||||
PopAndReport();
|
||||
return result;
|
||||
}
|
||||
|
@ -129,4 +129,14 @@ public sealed class Profiler
|
|||
{
|
||||
return ReportWithResult(Result.FromSuccess());
|
||||
}
|
||||
|
||||
[Conditional("DEBUG")]
|
||||
private void LogResultStackTrace(Result result)
|
||||
{
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
_logger.LogError("Profiled result was not successful: {ResultMessage}{NewLine}{StackTrace}",
|
||||
result.Error.Message, Environment.NewLine, new StackTrace(2, true).ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue