Skip to content

parseInactiveRecipients does not handle empty results correctly #168

@TKDBB84

Description

@TKDBB84

Occasionally the server returns a message with no emails included. This is a separate issue, however the parseInactiveRecipients function incorrectly returns a '.' instead of an empty array in this case. When an email that isn't valid is attempted to be sent the postmark server sometimes returns:

{
  ...
  code: 406,
  message: "You tried to send to recipient(s) that have been marked as inactive. Found inactive addresses: . Inactive recipients are ones that have generated a hard bounce, a spam complaint, or a manual suppression."
  ...
}

passing the message through parseInactiveRecipients results incorrectly in: [ '.' ]. When the expected result should be [].

Minimal Replication:

> const { Errors: postmarkErrors } = require('postmark')
> postmarkErrors.InactiveRecipientsError.parseInactiveRecipients('You tried to send to recipient(s) that have been marked as inactive. Found inactive addresses: . Inactive recipients are ones that have generated a hard bounce, a spam complaint, or a manual suppression.')

< [ '.' ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions