mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-19 16:33:36 +03:00
feat: assert that a Result is successful via the profiler in Debug builds
Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
9fe3dcfc51
commit
b34903aead
2 changed files with 7 additions and 0 deletions
|
@ -20,6 +20,11 @@ using Remora.Rest.Core;
|
||||||
using Serilog.Extensions.Logging;
|
using Serilog.Extensions.Logging;
|
||||||
|
|
||||||
namespace Octobot;
|
namespace Octobot;
|
||||||
|
// TODO: better organizing of interaction checks (and other related chains of method calls)
|
||||||
|
// TODO: avoid nesting as much as possible (like embed sending :/)
|
||||||
|
// TODO: remove stuff that doesn't need to be profiled
|
||||||
|
// if it needs to be profiled, try to put it inside of 'if' blocks so it doesn't appear all the time
|
||||||
|
// (so we know e.g. if a feature is active or not)
|
||||||
|
|
||||||
public sealed class Octobot
|
public sealed class Octobot
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,6 +58,7 @@ public sealed class Profiler
|
||||||
/// <returns>The original result.</returns>
|
/// <returns>The original result.</returns>
|
||||||
public Result PopWithResult(Result result)
|
public Result PopWithResult(Result result)
|
||||||
{
|
{
|
||||||
|
Debug.Assert(result.IsSuccess);
|
||||||
Pop();
|
Pop();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -115,6 +116,7 @@ public sealed class Profiler
|
||||||
/// <returns>The original result.</returns>
|
/// <returns>The original result.</returns>
|
||||||
public Result ReportWithResult(Result result)
|
public Result ReportWithResult(Result result)
|
||||||
{
|
{
|
||||||
|
Debug.Assert(result.IsSuccess);
|
||||||
PopAndReport();
|
PopAndReport();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue