feat(payments-adapter-ctbc-micro-fast-pay): detect HTML error pages#213
Open
ender503 wants to merge 2 commits into
Open
feat(payments-adapter-ctbc-micro-fast-pay): detect HTML error pages#213ender503 wants to merge 2 commits into
ender503 wants to merge 2 commits into
Conversation
ender503
commented
Jul 22, 2026
Contributor
- Add CTBCHtmlErrorResponseError to signal when CTBC returns an HTML error page instead of the expected encoded response, so callers can distinguish maintenance/outage pages from normal parsing failures
- Throw this error from sendAndGetResponse and re-throw it past the generic catch block instead of masking it as ERR_HOST_CONNECTION_FAILED
- Expose responseText on the error for logging/alerting on the raw payload, and export the class from the package entrypoint
- Cover the new behavior with tests for detection, message/property content, and the non-HTML passthrough case
- Add CTBCHtmlErrorResponseError to signal when CTBC returns an HTML error page instead of the expected encoded response, so callers can distinguish maintenance/outage pages from normal parsing failures - Throw this error from sendAndGetResponse and re-throw it past the generic catch block instead of masking it as ERR_HOST_CONNECTION_FAILED - Expose responseText on the error for logging/alerting on the raw payload, and export the class from the package entrypoint - Cover the new behavior with tests for detection, message/property content, and the non-HTML passthrough case Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Replace the plain Error thrown on POS query failure with CTBCPosQueryFailedError so callers can inspect respCode, errCode, and errDesc instead of parsing them out of a message string - Default errDesc to "Unknown error" when ERRDESC is absent, matching prior message formatting - Add tests covering the error type, its properties, and the missing-ERRDESC fallback Co-Authored-By: Claude Sonnet 5 <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.