Skip to content

Commit 6259ba2

Browse files
authored
Merge pull request #826 from nyaruka/EX-response-check
Do not log EX MT response check error
2 parents 47e0838 + c1cc157 commit 6259ba2

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

Diff for: handlers/external/handler.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ func (h *handler) Send(ctx context.Context, msg courier.MsgOut, res *courier.Sen
366366
}
367367

368368
if responseCheck != "" && !strings.Contains(string(respBody), responseCheck) {
369-
return courier.ErrResponseUnexpected
369+
return courier.ErrResponseUnexpectedUnlogged
370370
}
371371
}
372372

Diff for: handlers/external/handler_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ var xmlSendWithResponseContentTestCases = []OutgoingTestCase{
834834
Headers: map[string]string{"Content-Type": "text/xml; charset=utf-8"},
835835
Body: `<msg><to>+250788383383</to><text>Error Message</text><from>2020</from><quick_replies></quick_replies></msg>`,
836836
}},
837-
ExpectedError: courier.ErrResponseUnexpected,
837+
ExpectedError: courier.ErrResponseUnexpectedUnlogged,
838838
},
839839
{
840840
Label: "Send Attachment",

Diff for: sender.go

+9
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,15 @@ var ErrResponseUnexpected error = &SendError{
110110
clogMsg: "Response doesn't match expected values.",
111111
}
112112

113+
// ErrResponseUnexpectedUnlogged is same as ErrResponseUnexpected without logging so better for channels where response check is user configured.
114+
var ErrResponseUnexpectedUnlogged error = &SendError{
115+
msg: "response not expected values",
116+
retryable: false,
117+
loggable: false,
118+
clogCode: "response_unexpected",
119+
clogMsg: "Response doesn't match expected values.",
120+
}
121+
113122
// ErrContactStopped should be returned when channel tells us explicitly that the contact has opted-out
114123
var ErrContactStopped error = &SendError{
115124
msg: "contact opted out",

0 commit comments

Comments
 (0)