Cleanup conditions for handleError()
This commit is contained in:
14
commands.go
14
commands.go
@ -385,17 +385,13 @@ func handleError(err error, m chat1.MsgSummary, msg string) {
|
|||||||
log.LogError("%+v: %+v", tracker, err)
|
log.LogError("%+v: %+v", tracker, err)
|
||||||
if strings.HasPrefix(err.Error(), "405") {
|
if strings.HasPrefix(err.Error(), "405") {
|
||||||
k.SendMessageByConvID(m.ConvID, "Tesla returned an error. Please ensure your vehicle isn't currently being serviced.")
|
k.SendMessageByConvID(m.ConvID, "Tesla returned an error. Please ensure your vehicle isn't currently being serviced.")
|
||||||
return
|
} else if strings.HasPrefix(err.Error(), "400") {
|
||||||
}
|
k.SendMessageByConvID(m.ConvID, "Tesla returned an error. The command you tried to use may need an update. Please contact @rudi9719 with tracking ID %+v and the bad command.", tracker)
|
||||||
if strings.HasPrefix(err.Error(), "408") && !m.Content.Attachment.Uploaded {
|
} else if !m.Content.Attachment.Uploaded && strings.HasPrefix(err.Error(), "408") {
|
||||||
k.SendMessageByConvID(m.ConvID, "Unable to wake vehicle within the timeframe. Trying to run the command again.")
|
k.SendMessageByConvID(m.ConvID, "Unable to wake vehicle within the timeframe. Trying to run the command again.")
|
||||||
m.Content.Attachment.Uploaded = true
|
m.Content.Attachment.Uploaded = true
|
||||||
handleChat(m)
|
handleChat(m)
|
||||||
return
|
} else {
|
||||||
}
|
|
||||||
if strings.HasPrefix(err.Error(), "400") {
|
|
||||||
k.SendMessageByConvID(m.ConvID, "Tesla returned an error. The command you tried to use may need an update. Please contact @rudi9719 with tracking ID %+v and the bad command.", tracker)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
k.SendMessageByConvID(m.ConvID, msg, tracker)
|
k.SendMessageByConvID(m.ConvID, msg, tracker)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user