Skip to content

feat(payments-adapter-ctbc-micro-fast-pay): detect HTML error pages#213

Open
ender503 wants to merge 2 commits into
mainfrom
feat/ctbc-html-error-response-detection
Open

feat(payments-adapter-ctbc-micro-fast-pay): detect HTML error pages#213
ender503 wants to merge 2 commits into
mainfrom
feat/ctbc-html-error-response-detection

Conversation

@ender503

Copy link
Copy Markdown
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>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploying utils-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2746140
Status:🚫  Build failed.

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploying rytass-utils-storybook with  Cloudflare Pages  Cloudflare Pages

Latest commit: 2746140
Status:🚫  Build failed.

View logs

- 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>
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.

1 participant