From 01200ac98b5c09ccc68f07a617f8af8ba2c95087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Rasmussen?= Date: Mon, 25 Jul 2022 22:55:47 +0200 Subject: [PATCH] Increase error output --- pkg/temperature/ds18b20.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/temperature/ds18b20.go b/pkg/temperature/ds18b20.go index 85829e4..cbe5115 100644 --- a/pkg/temperature/ds18b20.go +++ b/pkg/temperature/ds18b20.go @@ -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)