chore(all): review error wrappings

- remove repetitive `cannot` and `failed` prefixes
- rename `unmarshaling` to `decoding`
This commit is contained in:
Quentin McGaw
2023-04-01 16:53:04 +00:00
parent 63a696d7e7
commit 4ba159e483
76 changed files with 178 additions and 178 deletions

View File

@@ -74,12 +74,12 @@ func (s *Server) healthCheck(ctx context.Context) (err error) {
const dialNetwork = "tcp4"
connection, err := s.dialer.DialContext(ctx, dialNetwork, address)
if err != nil {
return fmt.Errorf("cannot dial: %w", err)
return fmt.Errorf("dialing: %w", err)
}
err = connection.Close()
if err != nil {
return fmt.Errorf("cannot close connection: %w", err)
return fmt.Errorf("closing connection: %w", err)
}
return nil
@@ -91,7 +91,7 @@ func makeAddressToDial(address string) (addressToDial string, err error) {
addrErr := new(net.AddrError)
ok := errors.As(err, &addrErr)
if !ok || addrErr.Err != "missing port in address" {
return "", fmt.Errorf("cannot split host and port from address: %w", err)
return "", fmt.Errorf("splitting host and port from address: %w", err)
}
host = address
const defaultPort = "443"

View File

@@ -85,7 +85,7 @@ func Test_makeAddressToDial(t *testing.T) {
},
"bad address": {
address: "test.com::",
err: fmt.Errorf("cannot split host and port from address: address test.com::: too many colons in address"), //nolint:lll
err: fmt.Errorf("splitting host and port from address: address test.com::: too many colons in address"), //nolint:lll
},
}