Skip to content

Commit 8e5739d

Browse files
Potential fix for code scanning alert no. 366: Generic catch clause
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent b82ab2c commit 8e5739d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Node.Runtime/Services/LeasePullService.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,13 @@ private async Task ProcessLeaseAsync(Lease lease, CancellationToken cancellation
539539
{
540540
_logger.LogError(rpcEx, "gRPC error reporting failure for lease {LeaseId}: {StatusCode}", lease.LeaseId, rpcEx.StatusCode);
541541
}
542-
catch (Exception failEx)
542+
// Only catch non-fatal exceptions during failure reporting.
543+
// Do not catch OutOfMemoryException, StackOverflowException, or ThreadAbortException
544+
catch (Exception failEx) when (
545+
!(failEx is OutOfMemoryException) &&
546+
!(failEx is StackOverflowException) &&
547+
!(failEx is ThreadAbortException)
548+
)
543549
{
544550
_logger.LogError(failEx, "Unexpected error reporting failure for lease {LeaseId}", lease.LeaseId);
545551
}

0 commit comments

Comments
 (0)