Increase error output

This commit is contained in:
Søren Rasmussen 2022-07-25 22:55:47 +02:00
parent 5e1db5e14a
commit 01200ac98b

View file

@ -223,12 +223,12 @@ func read(sensor string) (int64, error) {
raw := string(data)
if !strings.Contains(raw, " YES") {
return 0.0, fmt.Errorf("%w: checksum failed", ErrReadSensor)
return 0.0, fmt.Errorf("%w: checksum failed [%v]", ErrReadSensor, raw)
}
i := strings.LastIndex(raw, "t=")
if i == -1 {
return 0.0, fmt.Errorf("%w: t= not found", ErrReadSensor)
return 0.0, fmt.Errorf("%w: t= not found in [%v]", ErrReadSensor, raw)
}
c, err := strconv.ParseInt(raw[i+2:len(raw)-1], 10, 64)