all: Tweak error creation (#6391)
- In the few places where we wrap errors, use the new Go 1.13 "%w" construction instead of %s or %v. - Where we create errors with constant strings, consistently use errors.New and not fmt.Errorf. - Remove capitalization from errors in the few places where we had that.
This commit is contained in:
+2
-2
@@ -232,7 +232,7 @@ func (p *Process) Events(since int) ([]Event, error) {
|
||||
dec.UseNumber()
|
||||
err = dec.Decode(&evs)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Events: %s in %q", err, bs)
|
||||
return nil, fmt.Errorf("events: %w in %q", err, bs)
|
||||
}
|
||||
return evs, err
|
||||
}
|
||||
@@ -398,7 +398,7 @@ func (p *Process) readResponse(resp *http.Response) ([]byte, error) {
|
||||
return bs, err
|
||||
}
|
||||
if resp.StatusCode != 200 {
|
||||
return bs, fmt.Errorf("%s", resp.Status)
|
||||
return bs, errors.New(resp.Status)
|
||||
}
|
||||
return bs, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user