demo(02-silent-catch): 02 — Silent exception swallow in payment path#151
demo(02-silent-catch): 02 — Silent exception swallow in payment path#151
Conversation
See scenarios/02-silent-catch/README.md for the expected verdict.
| new PaymentRequest(order.Id, priced.Total, order.Customer.Email), | ||
| ct).ConfigureAwait(false); | ||
| } | ||
| catch |
There was a problem hiding this comment.
GCI0007 — Error Handling Integrity
Swallowed exception detected in src/OrderService/Processing/OrderProcessor.cs
Evidence:
catch
💡 Suggested action: Log the exception, rethrow it, or handle it explicitly. Never swallow silently.
Confidence: High | Severity: Block
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 674a2b4a99
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| catch | ||
| { | ||
| } |
There was a problem hiding this comment.
Preserve payment exceptions instead of swallowing them
The bare catch in ProcessAsync absorbs every exception thrown by ChargeAsync and then continues down the normal decline path, which marks the order failed and persists that state. In failure scenarios like cancellation (OperationCanceledException), timeouts, or transport faults, this converts infrastructure errors into an indistinguishable business decline ("Payment failed."), preventing callers from handling retries/cancellation correctly and hiding the real cause from operations.
Useful? React with 👍 / 👎.
02 — Silent exception swallow in payment path
Expected verdict: ❌ Fails — GauntletCI should fire GCI0007 (silent catch).
What changed
src/OrderService/Processing/OrderProcessor.cswas updated to make thepayment call "more resilient" by wrapping it in a try/catch.
The catch block swallows every exception (
catch { ... }) and turns itinto a generic
PaymentResult(false, null, "Payment failed.")— no logging,no rethrow, no telemetry. Transient errors, programmer errors, cancellation,
all become indistinguishable failures.
Why this is risky
OperationCanceledExceptionandOutOfMemoryExceptionget swallowed too.What GauntletCI catches
GCI0007 Silent exception swallow— the catch block has no logging, nore-throw, and produces a result that cannot be distinguished from a
business-level decline.