Skip to content

Commit

Permalink
Do not log EX MT response check error
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Jan 9, 2025
1 parent 47e0838 commit b73c789
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion handlers/external/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ func (h *handler) Send(ctx context.Context, msg courier.MsgOut, res *courier.Sen
}

if responseCheck != "" && !strings.Contains(string(respBody), responseCheck) {
return courier.ErrResponseUnexpected
return courier.ErrResponseUnexpectedUnlogged
}
}

Expand Down
2 changes: 1 addition & 1 deletion handlers/external/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,7 @@ var xmlSendWithResponseContentTestCases = []OutgoingTestCase{
Headers: map[string]string{"Content-Type": "text/xml; charset=utf-8"},
Body: `<msg><to>+250788383383</to><text>Error Message</text><from>2020</from><quick_replies></quick_replies></msg>`,
}},
ExpectedError: courier.ErrResponseUnexpected,
ExpectedError: courier.ErrResponseUnexpectedUnlogged,
},
{
Label: "Send Attachment",
Expand Down
9 changes: 9 additions & 0 deletions sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ var ErrResponseUnexpected error = &SendError{
clogMsg: "Response doesn't match expected values.",
}

// ErrResponseUnexpectedUnlogged should be returned when channel response doesn't match what we expect and unlogged
var ErrResponseUnexpectedUnlogged error = &SendError{
msg: "response not expected values",
retryable: false,
loggable: false,
clogCode: "response_unexpected",
clogMsg: "Response doesn't match expected values.",
}

// ErrContactStopped should be returned when channel tells us explicitly that the contact has opted-out
var ErrContactStopped error = &SendError{
msg: "contact opted out",
Expand Down

0 comments on commit b73c789

Please sign in to comment.