Fixes assuming Telnyx error codes are numbers (#635)

This commit is contained in:
Chris Anderson 2025-03-02 12:59:13 -06:00 committed by GitHub
parent 0540af3ca9
commit 9e89e815e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -79,10 +79,10 @@ export default class TelnyxTextProvider extends TextProvider {
// https://support.telnyx.com/en/articles/6505121-telnyx-messaging-error-codes
const error = responseBody.errors?.[0]
if (error?.code === 40300) {
if (error?.code === '40300') {
// Unable to send because recipient has unsubscribed
throw new UnsubscribeTextError(this.type, to, error.title)
} else if (error?.code === 40008) {
} else if (error?.code === '40008') {
// Unable to send because region is not enabled
throw new UndeliverableTextError(this.type, to, error.title)
}