Skip to content

demo(02-silent-catch): 02 — Silent exception swallow in payment path#151

Open
EricCogen wants to merge 1 commit intomainfrom
demo/02-silent-catch
Open

demo(02-silent-catch): 02 — Silent exception swallow in payment path#151
EricCogen wants to merge 1 commit intomainfrom
demo/02-silent-catch

Conversation

@EricCogen
Copy link
Copy Markdown
Owner

02 — Silent exception swallow in payment path

Expected verdict: ❌ Fails — GauntletCI should fire GCI0007 (silent catch).

What changed

src/OrderService/Processing/OrderProcessor.cs was updated to make the
payment call "more resilient" by wrapping it in a try/catch.

The catch block swallows every exception (catch { ... }) and turns it
into 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

  • Production incidents become invisible: you'll never know why charges fail.
  • OperationCanceledException and OutOfMemoryException get swallowed too.
  • The catch hides bugs that would otherwise surface in development.

What GauntletCI catches

GCI0007 Silent exception swallow — the catch block has no logging, no
re-throw, and produces a result that cannot be distinguished from a
business-level decline.

See scenarios/02-silent-catch/README.md for the expected verdict.
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GauntletCI found issues in this PR. See inline comments for details.

new PaymentRequest(order.Id, priced.Total, order.Customer.Email),
ct).ConfigureAwait(false);
}
catch
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GCI0007 — Error Handling Integrity

Swallowed exception detected in src/OrderService/Processing/OrderProcessor.cs

Evidence:

catch

⚠️ Why it matters: Empty or silent catch blocks hide failures, making bugs invisible and debugging nearly impossible.

💡 Suggested action: Log the exception, rethrow it, or handle it explicitly. Never swallow silently.

Confidence: High | Severity: Block

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +50 to +52
catch
{
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant