Code RoomPayment capture swallows all exceptions
MediumPrep Room Coding #1723

Payment capture swallows all exceptions

Code reviewCode quality & reviewMid–Senior~20 min

Review this Python payment-capture helper.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.

0:00 of about 20 min
Mark a line and say what kind of problem it is.0 findings
1def capture_payment(charge_id):
2 try:
3 resp = gateway.capture(charge_id)
4 db.mark_captured(charge_id, resp.txn_id)
5 return True
6 except Exception:
7 pass
8 return False
9 
10def run_batch(charge_ids):
11 results = {}
12 for cid in charge_ids:
13 results[cid] = capture_payment(cid)
14 return results
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.