Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not log EX MT response check error #826

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 is same as ErrResponseUnexpected without logging so better for channels where response check is user configured.
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
Loading