Last active
March 24, 2022 04:32
-
-
Save diego-augusto/a8219dc70b0de413d1372923e5be0fe0 to your computer and use it in GitHub Desktop.
golang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
we, ok := err.(mongo.WriteException) | |
if ok { | |
if strings.Contains(we.WriteErrors.Error(), "E11000") { | |
if strings.HasPrefix(event.Data.Conversation.Protocol, "20220322") { | |
event.Data.Conversation.Protocol = replaceAtIndex(event.Data.Conversation.Protocol, '3', 8) | |
fmt.Printf("\nnew protocol: %s", event.Data.Conversation.Protocol) | |
err := handler(event) | |
if err != nil { | |
log.Printf("\nerror save new event message: %s", err.Error()) | |
return | |
} | |
_ = message.Ack() | |
} | |
return | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment