1
0
Fork 1
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:
Octol1ttle 2023-12-31 00:31:37 +05:00
parent 9fe3dcfc51
commit b34903aead
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
2 changed files with 7 additions and 0 deletions

View file

@ -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
{ {

View file

@ -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;
} }