feat: add classify_orchestration_error helper - #27
Merged
Conversation
Classify thrown errors that escape process_x402_settle (e.g. from mppx.compose, a Stripe SDK call, or any payment-side library code wrapped in a single try/except around the full settle flow). Returns the same ClassifiedX402Error shape that classify_x402_settle_result already returns for tagged failures. Pattern matching is case-insensitive substring on the error message: - "x402version" / "invalid payment" / "unsupported x402" → 400 payment_proof_invalid / regenerate_payment_credential - "stripe" / "facilitator" / "cdp" → 503 payment_provider_unavailable / retry_or_swap_method - Anything else → None (caller rethrows) The helper never swallows unknown errors. Substring matchers are intentionally narrow — new error families land here explicitly rather than letting the helper grow opaque heuristics. Tests lock 12 cross-language fixtures with the @agent-score/commerce sibling. Parametrized so multiple drifts surface independently. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tests
Test plan
🤖 Generated with Claude Code