From 0a4cc0474df9854851a95e1b283468d6d62344b8 Mon Sep 17 00:00:00 2001 From: Will Hawkins Date: Fri, 14 Jul 2023 11:01:32 -0400 Subject: Suppress non-error of cancelled context causing probe send to fail It is not an error (per se) for a probe not to be able to be sent when the context of its execution is cancelled. Log the error when debugging only. Signed-off-by: Will Hawkins --- probe/probe.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'probe') diff --git a/probe/probe.go b/probe/probe.go index fa19411..3939076 100644 --- a/probe/probe.go +++ b/probe/probe.go @@ -108,6 +108,15 @@ func Probe( probe_resp, err := client.Do(probe_req) if err != nil { + if debug.IsDebug(debugging.Level) { + fmt.Printf( + "(%s) (%s Probe %v) An error occurred during http.Do: %v\n", + debugging.Prefix, + probeType.Value(), + probeId, + err, + ) + } return nil, err } @@ -119,6 +128,15 @@ func Probe( // TODO: Make this interruptable somehow by using _ctx_. _, err = io.ReadAll(probe_resp.Body) if err != nil { + if debug.IsDebug(debugging.Level) { + fmt.Printf( + "(%s) (%s Probe %v) An error occurred during io.ReadAll: %v\n", + debugging.Prefix, + probeType.Value(), + probeId, + err, + ) + } return nil, err } time_after_probe := time.Now() -- cgit v1.2.3