Skip to content

Commit

Permalink
targets: include inner error in message
Browse files Browse the repository at this point in the history
Signed-off-by: Tomás Senart <[email protected]>
  • Loading branch information
tsenart committed Oct 2, 2023
1 parent 712ff2e commit 78dfd3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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
}
Expand Down

0 comments on commit 78dfd3d

Please sign in to comment.