Skip to content

fix(sdk): throw SwiftRemitError for batch size violations#757

Open
mathewsap45 wants to merge 1 commit into
Haroldwonder:mainfrom
mathewsap45:fix/681-batch-size-validation
Open

fix(sdk): throw SwiftRemitError for batch size violations#757
mathewsap45 wants to merge 1 commit into
Haroldwonder:mainfrom
mathewsap45:fix/681-batch-size-validation

Conversation

@mathewsap45
Copy link
Copy Markdown

Summary

Closes #681

Updates batchCreateRemittances in sdk/src/client.ts to throw a typed SwiftRemitError with ErrorCode.InvalidBatchSize when the input array exceeds MAX_BATCH_SIZE (50).

Problem

The SDK was throwing a generic Error, inconsistent with the rest of the SDK which uses SwiftRemitError for typed error handling. Callers couldn't catch and branch on the error code.

Fix

  • Import SwiftRemitError and ErrorCode from ./errors.js
  • Replace throw new Error(...) with throw new SwiftRemitError(ErrorCode.InvalidBatchSize, ...) for both empty-batch and oversized-batch cases

…er#681)

Replace generic Error with SwiftRemitError(ErrorCode.InvalidBatchSize)
in batchCreateRemittances so callers can catch and branch on the typed
error code, consistent with the rest of the SDK error handling.
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 1, 2026

@mathewsap45 is attempting to deploy a commit to the Harold's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@mathewsap45 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

sdk/src/client.ts MAX_BATCH_SIZE constant not enforced in batchCreateRemittances

1 participant