Do not print status message twice
This commit is contained in:
parent
c694c91ead
commit
9bea501013
|
@ -9,6 +9,7 @@ package bulb
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
"net/textproto"
|
"net/textproto"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -61,7 +62,8 @@ func statusCodeToError(code int, reply string) *textproto.Error {
|
||||||
err := new(textproto.Error)
|
err := new(textproto.Error)
|
||||||
err.Code = code
|
err.Code = code
|
||||||
if msg, ok := statusCodeStringMap[code]; ok {
|
if msg, ok := statusCodeStringMap[code]; ok {
|
||||||
err.Msg = fmt.Sprintf("%s: %s", msg, reply)
|
trimmedReply := strings.TrimSpace(strings.TrimPrefix(reply, msg))
|
||||||
|
err.Msg = fmt.Sprintf("%s: %s", msg, trimmedReply)
|
||||||
} else {
|
} else {
|
||||||
err.Msg = fmt.Sprintf("Unknown status code (%03d): %s", code, reply)
|
err.Msg = fmt.Sprintf("Unknown status code (%03d): %s", code, reply)
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue