mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-01-31 08:51:12 +03:00
Don't log stack traces for cancelled operations (#327)
This PR fixes an issue where the `LogResultStackTrace` method would log stack traces for results that encountered an error due to a cancelled operation/task. The `LoggerExtensions` class already skipped `TaskCanceledException`s, but didn't skip `OperationCanceledException`s (which is a parent of `TaskCanceledException`). The patch specifically does not affect *inner* results which are canceled. Skipping logging these could hide the true cause of an error which appears important
This commit is contained in:
parent
d6d2660fb0
commit
e457b4609e
2 changed files with 2 additions and 2 deletions
|
@ -25,7 +25,7 @@ public static class LoggerExtensions
|
|||
|
||||
if (result.Error is ExceptionError exe)
|
||||
{
|
||||
if (exe.Exception is TaskCanceledException)
|
||||
if (exe.Exception is OperationCanceledException)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public static class ResultExtensions
|
|||
|
||||
private static void LogResultStackTrace(Result result)
|
||||
{
|
||||
if (result.IsSuccess)
|
||||
if (result.IsSuccess || result.Error is ExceptionError { Exception: OperationCanceledException })
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue