Skip to content

fix(core): populate connector_http_status_code on UCS PSync connector error#12963

Open
AmitsinghTanwar007 wants to merge 1 commit into
mainfrom
autofix/noon-psync-17201
Open

fix(core): populate connector_http_status_code on UCS PSync connector error#12963
AmitsinghTanwar007 wants to merge 1 commit into
mainfrom
autofix/noon-psync-17201

Conversation

@AmitsinghTanwar007

@AmitsinghTanwar007 AmitsinghTanwar007 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Closes #12986

… error

When UCS surfaces a connector error as a gRPC ConnectorError on the PSync
flow, the gateway built the ErrorResponse (carrying status_code) but never
set router_data.connector_http_status_code, leaving it None. The native
PSync path and the UCS success path both populate it from the connector
HTTP status. Mirror the success path so the field is set on the error
branch too.

Closes #12962
Fixes juspay/hyperswitch-cloud#17201

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@AmitsinghTanwar007 AmitsinghTanwar007 requested a review from a team as a code owner June 24, 2026 18:50
@semanticdiff-com

semanticdiff-com Bot commented Jun 24, 2026

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  crates/router/src/core/payments/gateway/psync_gateway.rs  0% smaller

@XyneSpaces

Copy link
Copy Markdown

Review Summary

PR #12963 correctly propagates connector_http_status_code on UCS PSync connector errors. This is a straightforward fix that aligns error path behavior with the success path.

Analysis

Change: Adds router_data.connector_http_status_code = Some(status_code); in the UCS error handling branch of psync_gateway.rs.

Why this matters: The connector_http_status_code field is used for debugging and analytics. Previously, when UCS returned a connector error (e.g., 4xx/5xx from the downstream connector), this field would be None even though the HTTP status was available in the error response.

Code quality notes:

  • The comment explaining the mirroring behavior is helpful
  • The change is minimal and focused
  • No breaking changes to the API or data model

One minor suggestion:

Consider adding a debug log when the status code is populated on the error path, similar to how other gateway operations log connector responses. This would help with troubleshooting in production:

logger::debug!(
    "UCS PSync error: connector_http_status_code={}",
    status_code
);

Overall, this is a clean fix that addresses a gap in error handling. ✅

@XyneSpaces XyneSpaces left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review comment on connector_http_status_code addition

);
// Mirror the success path: propagate the connector HTTP
// status code from the UCS connector error so that
// `connector_http_status_code` is populated (matching the

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nit] This change mirrors #12971. Consider if both gateway files (authorize_gateway.rs and psync_gateway.rs) should share this logic via a common helper method to ensure consistent behavior across UCS error handling paths.

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.

[shadow-validation] noon/psync: UCS↔HS request diff

2 participants