Skip to content

[BWC] Enhancement - handle 429, 500, 502, 504 err status codes#4116

Merged
kajoseph merged 2 commits intobitpay:masterfrom
gabrielbazan7:ref/error-handling
Mar 11, 2026
Merged

[BWC] Enhancement - handle 429, 500, 502, 504 err status codes#4116
kajoseph merged 2 commits intobitpay:masterfrom
gabrielbazan7:ref/error-handling

Conversation

@gabrielbazan7
Copy link
Copy Markdown
Contributor

@gabrielbazan7 gabrielbazan7 commented Mar 4, 2026

Description

Adds typed errors for status codes that Cloudflare returns as raw HTML (429, 500, 502, 504). Now the client gets a readable message instead of HTML.

Changelog

  • Handle HTTP 429, 500, 502, 504 with typed BwcError in request.ts
  • Add corresponding error specs with user-friendly messages

Checklist

  • I have read CONTRIBUTING.md and verified that this PR follows the guidelines and requirements outlined in it.
  • I have added the appropriate package tag(s) (e.g. BWC if modifying the bitcore-wallet-client package, CLI if modifying the bitcore-cli package, etc.)
  • I have verified that this is not an existing PR (open or closed)

@gabrielbazan7 gabrielbazan7 changed the title BWC: Enhancement - handle 429, 500, 502, 504 err status codes [BWC] Enhancement - handle 429, 500, 502, 504 err status codes Mar 4, 2026
@kajoseph kajoseph added the BWC This pull request modifies the bitcore-wallet-client package label Mar 11, 2026
Copy link
Copy Markdown
Collaborator

@kajoseph kajoseph left a comment

Choose a reason for hiding this comment

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

One quick suggestion

},
{
name: 'INTERNAL_SERVER_ERROR',
message: 'Wallet service error. Please try again later.'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Maybe we should prompt them to contact support if the problem persists.

Wallet service error. Please try again later or contact support if the problem persists.

@gabrielbazan7 gabrielbazan7 marked this pull request as draft March 11, 2026 19:29
@gabrielbazan7 gabrielbazan7 marked this pull request as ready for review March 11, 2026 19:52
@kajoseph kajoseph merged commit 584126a into bitpay:master Mar 11, 2026
13 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BWC This pull request modifies the bitcore-wallet-client package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants