Skip to content

Commit

Permalink
fix(station): corrected SDk to SDK (#255)
Browse files Browse the repository at this point in the history
* fix(station): corrected SDk to SDK

* created constant to store invalid message header error
  • Loading branch information
Blake Smreker committed Aug 10, 2022
1 parent 616de47 commit 5a73666
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion handlers/poison_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import (

type PoisonMessagesHandler struct{}

const invalidPoisonHeaderErrMessage string = "Missing mandatory message headers, please upgrade the SDK version you are using"

func (pmh PoisonMessagesHandler) HandleNewMessage(msg *nats.Msg) {
var message map[string]interface{}
err := json.Unmarshal(msg.Data, &message)
Expand All @@ -54,7 +56,7 @@ func (pmh PoisonMessagesHandler) HandleNewMessage(msg *nats.Msg) {
producedByHeader := poisonMessageContent.Header.Get("producedBy")

if connectionIdHeader == "" || producedByHeader == "" {
logger.Error("Error while getting notified about a poison message: Missing mandatory message headers, please upgrade the SDk version you are using")
logger.Error("Error while getting notified about a poison message: " + invalidPoisonHeaderErrMessage)
return
}

Expand Down
4 changes: 2 additions & 2 deletions handlers/stations.go
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,8 @@ func (sh StationsHandler) GetMessageDetails(c *gin.Context) {
producedByHeader := natsMsg.Header.Get("producedBy")

if connectionIdHeader == "" || producedByHeader == "" {
logger.Error("Error while getting notified about a poison message: Missing mandatory message headers, please upgrade the SDk version you are using")
c.AbortWithStatusJSON(configuration.SHOWABLE_ERROR_STATUS_CODE, gin.H{"message": "Error while getting notified about a poison message: Missing mandatory message headers, please upgrade the SDk version you are using"})
logger.Error("Error while getting notified about a poison message: " + invalidPoisonHeaderErrMessage)
c.AbortWithStatusJSON(configuration.SHOWABLE_ERROR_STATUS_CODE, gin.H{"message": "Error while getting notified about a poison message: " + invalidPoisonHeaderErrMessage})
return
}

Expand Down

0 comments on commit 5a73666

Please sign in to comment.