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
fix(station): corrected SDk to SDK #255
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better if this message was a constant for the whole package, maybe call it invalidHeaderErrMessage. you can place it anywhere you see fit
Hey @bsmirks, all good with the contribution workflow! |
Sounds good, I will play with implementing this and update the PR accordingly. |
I've updated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, although my naming may have confused a little, I think we can include that "Error while getting notified..." in the constant if it's not being used in parts anywhere else.
that said, probably the name should suggest that it only comes from poison messages, like invalidPosionHeaderErrMessage
handlers/poison_messages.go
Outdated
@@ -31,6 +31,8 @@ import ( | |||
|
|||
type PoisonMessagesHandler struct{} | |||
|
|||
const invalidHeaderErrMessage string = "Missing mandatory message headers, please upgrade the SDK version you are using" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const invalidHeaderErrMessage string = "Missing mandatory message headers, please upgrade the SDK version you are using" | |
const invalidPoisonHeaderErrMessage string = "Error while getting notified about a poison message: Missing mandatory message headers, please upgrade the SDK version you are using" |
handlers/poison_messages.go
Outdated
@@ -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: " + invalidHeaderErrMessage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.Error("Error while getting notified about a poison message: " + invalidHeaderErrMessage) | |
logger.Error(invalidPoisonHeaderErrMessage) |
handlers/stations.go
Outdated
logger.Error("Error while getting notified about a poison message: " + invalidHeaderErrMessage) | ||
c.AbortWithStatusJSON(configuration.SHOWABLE_ERROR_STATUS_CODE, gin.H{"message": "Error while getting notified about a poison message: " + invalidHeaderErrMessage}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger.Error("Error while getting notified about a poison message: " + invalidHeaderErrMessage) | |
c.AbortWithStatusJSON(configuration.SHOWABLE_ERROR_STATUS_CODE, gin.H{"message": "Error while getting notified about a poison message: " + invalidHeaderErrMessage}) | |
logger.Error(invalidPoisonHeaderErrMessage) | |
c.AbortWithStatusJSON(configuration.SHOWABLE_ERROR_STATUS_CODE, gin.H{"message": invalidPoisonHeaderErrMessage}) |
I have made a change to the name of the constant as suggested as I think that making the constant more descriptive is worthwhile in the long run for readability's sake. However, I think that the bit about "Error while getting notified about..." should stay as is since it is being used in parts elsewhere like here which is where I got the convention for leaving it there and appending the constant afterwards. Let me know what you think! Joined the Discord :) |
This is a fix for #252 in which I found instances of the word
SDk
and replaced withSDK
. Please let me know if anything was missed in the contribution workflow. Thanks!