fix: properly handle HTTP 4xx errors instead of wrapping as 503#468
Open
gibaros wants to merge 2 commits intomojaloop:mainfrom
Open
fix: properly handle HTTP 4xx errors instead of wrapping as 503#468gibaros wants to merge 2 commits intomojaloop:mainfrom
gibaros wants to merge 2 commits intomojaloop:mainfrom
Conversation
Axios throws on non-2xx responses, and catch blocks were blanket-converting all errors to DESTINATION_COMMUNICATION_ERROR (1001 → HTTP 503). This hid the actual error (e.g. 400 Bad Request) behind a generic 503. Now differentiates HTTP response errors from network errors: - If response contains FSPIOP errorInformation, propagate it directly - 4xx client errors → CLIENT_ERROR (preserves actual error code) - 5xx / network errors → DESTINATION_COMMUNICATION_ERROR (unchanged) Also updates dependencies, fixes vulnerabilities, and bumps Node to 22.22.2. Refs: mojaloop/project#4198 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add tests for FSPIOP errorInformation propagation from HTTP 4xx responses - Add tests for CLIENT_ERROR handling on 4xx without errorInformation - Add tests for 5xx DESTINATION_COMMUNICATION_ERROR handling - Add convict CVEs to .grype.yaml ignore list (unfixable transitive dep) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
4 tasks
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
DESTINATION_COMMUNICATION_ERROR(1001 → HTTP 503), hiding the actual errorError Handling Fix
Applies the same pattern from mojaloop/central-services-shared#474 to quoting-service's own request handling code:
errorInformationerrorInformationFiles Changed
src/lib/http.js— centralhttpRequestfunctionsrc/model/quotes.js—sendErrorCallbackcatch blocksrc/model/fxQuotes.js—sendErrorCallback+sendHttpRequestsrc/model/bulkQuotes.js—sendErrorCallbackcatch blockDependency Updates
@mojaloop/central-services-shared: 18.35.6 → 18.35.7axios: 1.13.6 → 1.15.0@hapi/hapi: 21.4.7 → 21.4.8knex: 3.2.5 → 3.2.9,mysql2: 3.20.0 → 3.22.0Refs: mojaloop/project#4198
Test plan
🤖 Generated with Claude Code