From 78dfd3d0663e0d629a18bc6fd74f76e747a5e29b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Senart?= Date: Mon, 2 Oct 2023 10:11:03 +0200 Subject: [PATCH] targets: include inner error in message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Senart --- lib/targets.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/targets.go b/lib/targets.go index fee3f383..ada930d9 100644 --- a/lib/targets.go +++ b/lib/targets.go @@ -297,7 +297,7 @@ func NewHTTPTargeter(src io.Reader, body []byte, hdr http.Header) Targeter { } tgt.Method = tokens[0] if _, err = url.ParseRequestURI(tokens[1]); err != nil { - return fmt.Errorf("bad URL: %s", tokens[1]) + return fmt.Errorf("bad URL: %s, %w", tokens[1], err) } tgt.URL = tokens[1] line = strings.TrimSpace(sc.Peek()) @@ -311,7 +311,7 @@ func NewHTTPTargeter(src io.Reader, body []byte, hdr http.Header) Targeter { continue } else if strings.HasPrefix(line, "@") { if tgt.Body, err = os.ReadFile(line[1:]); err != nil { - return fmt.Errorf("bad body: %s", err) + return fmt.Errorf("bad body: %w", err) } break }