sqs-producer icon indicating copy to clipboard operation
sqs-producer copied to clipboard

Attach failed message ids to error object

Open knicola opened this issue 7 months ago • 4 comments

Description: Throw a custom error, when messages fail to send, with an additional property to expose the failed message ids for programmatic access.

Type of change:

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)

Why is this change required?: In cases where we have to take additional steps for the failed messages, we have to parse the error message in order to get their IDs.

Code changes:

  • Add a custom FailedMessagesError error class, with a failedMessages property of type string[] to hold the IDs of the messages that failed to send.

Checklist:

  • [x] My code follows the code style of this project.
  • [ ] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [x] I have added tests to cover my changes.
  • [x] All new and existing tests passed.

knicola avatar Nov 18 '23 20:11 knicola