diff --git a/auth/bearer.go b/auth/bearer.go index 5a4027b9987184abde0cbc62aa9c7123c31fecb9..3bac46f71ed39589ddaa2b1500adaaaf7c5b3e74 100644 --- a/auth/bearer.go +++ b/auth/bearer.go @@ -141,7 +141,7 @@ grant = fmt.Sprintf("%s/%s", g.local, grant) } if mode != RO && mode != RW { - panic(fmt.Errorf("Invalid access mode")) + panic(fmt.Errorf("invalid access mode")) } if g.ReadOnly && mode == RW { return false diff --git a/auth/middleware.go b/auth/middleware.go index 70ad49bab9b3eee3582af8191e711a877c5e2c26..b3f7c4832cddd4e8f757d1c5b947f3eb946b2484 100644 --- a/auth/middleware.go +++ b/auth/middleware.go @@ -96,7 +96,7 @@ return errors.Errorf(errors.AccessDenied, "Access denied, missing %v:%v grant", scope, kind) } return nil default: - panic(fmt.Errorf("Unknown auth method %q for access check", authctx.AuthMethod)) + panic(fmt.Errorf("unknown auth method %q for access check", authctx.AuthMethod)) } } @@ -169,7 +169,7 @@ // TODO: Fetch user info from meta if necessary if err := rows.Err(); err != nil { panic(err) } - panic(fmt.Errorf("Multiple matching user accounts; invariant broken")) + panic(fmt.Errorf("multiple matching user accounts; invariant broken")) } return nil }); err != nil { @@ -178,7 +178,7 @@ } if auth.UserType == USER_TYPE_SUSPENDED { return nil, fmt.Errorf( - "Account suspended with the following notice: %s\nContact support", + "account suspended with the following notice: %s\nContact support", *auth.SuspensionNotice) } @@ -245,7 +245,7 @@ host = r.RemoteAddr } ip := net.ParseIP(host) if ip == nil { - panic(fmt.Errorf("Unable to parse remote address")) + panic(fmt.Errorf("unable to parse remote address")) } if !config.IsInternalIP(ip) { authError(w, fmt.Sprintf("Invalid source IP %s for internal auth", ip), http.StatusUnauthorized) @@ -316,7 +316,7 @@ } func FetchMetaProfile(ctx context.Context, username string, user *AuthContext) error { if config.ServiceName(ctx) == "meta.sr.ht" { - panic(fmt.Errorf("Cannot fetch profile from ourselves")) + panic(fmt.Errorf("cannot fetch profile from ourselves")) } query := client.GraphQLQuery{ @@ -393,7 +393,7 @@ if err := row.Scan(&user.UserID, &user.Created, &user.Updated, &user.Username, &user.Email, &user.UserType, &user.URL, &user.Location, &user.Bio, &user.SuspensionNotice); err != nil { if err == sql.ErrNoRows { - panic(fmt.Errorf("Failed to upsert user record from meta.sr.ht")) + panic(fmt.Errorf("failed to upsert user record from meta.sr.ht")) } return err } @@ -460,7 +460,7 @@ if rows.Next() { if err = rows.Err(); err != nil { return err } - panic(fmt.Errorf("Multiple users of the same username; invariant broken")) + panic(fmt.Errorf("multiple users of the same username; invariant broken")) } return nil }) @@ -573,7 +573,7 @@ func WebhookAuth(ctx context.Context, auth *AuthContext, tokenHash [64]byte, rawGrants string, clientID *string, expires *time.Time) (context.Context, error) { if expires != nil && time.Now().UTC().After(*expires) { - return nil, fmt.Errorf("The authentication token used to create this webhook has expired") + return nil, fmt.Errorf("the authentication token used to create this webhook has expired") } grants, err := DecodeGrants(ctx, rawGrants) @@ -643,7 +643,7 @@ func ForContext(ctx context.Context) *AuthContext { raw, ok := ctx.Value(userCtxKey).(*AuthContext) if !ok { - panic(fmt.Errorf("Invalid authentication context")) + panic(fmt.Errorf("invalid authentication context")) } return raw } diff --git a/config/config.go b/config/config.go index 00beea948b46f710bd103205b32d35516645a032..5743e9a14cdecd83c79bd81c653fdea6efe09d9a 100644 --- a/config/config.go +++ b/config/config.go @@ -132,7 +132,7 @@ return origin } } - panic(fmt.Errorf("No suitable origin configured for requested API")) + panic(fmt.Errorf("no suitable origin configured for requested API")) } const DefaultQueueSize = 512 diff --git a/config/middleware.go b/config/middleware.go index dd1b1f4794707b02bf88cff4b174dbd4cbe8f49f..3b42e32a98f68a94b652e40e4def67bb491d8249 100644 --- a/config/middleware.go +++ b/config/middleware.go @@ -35,7 +35,7 @@ func ForContext(ctx context.Context) ini.File { raw, ok := ctx.Value(configCtxKey).(ini.File) if !ok { - panic(errors.New("Invalid config context")) + panic(errors.New("invalid config context")) } return raw } @@ -43,7 +43,7 @@ func ServiceName(ctx context.Context) string { raw, ok := ctx.Value(serviceCtxKey).(*string) if !ok { - panic(errors.New("Invalid service config context")) + panic(errors.New("invalid service config context")) } return *raw } diff --git a/crypto/crypto.go b/crypto/crypto.go index 3fd31e0534b286ee9d38a8d66cb872a3d9116c7e..642e7dc69537f99d303dea74021e0a25a65e760c 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -71,7 +71,7 @@ } func DecryptWithExpiration(payload []byte, expiry time.Duration) []byte { if expiry == 0 { - panic(fmt.Errorf("DecryptWithExpiration given expiration of zero. Use DecryptWithoutExpiration if you really meant it.")) + panic(fmt.Errorf("DecryptWithExpiration given expiration of zero - use DecryptWithoutExpiration if you really meant it")) } return fernet.VerifyAndDecrypt(payload, expiry, []*fernet.Key{fernetKey}) } @@ -95,7 +95,7 @@ func SignWebhook(payload []byte) (string, string) { var nonceSeed [8]byte _, err := rand.Read(nonceSeed[:]) if err != nil { - panic(fmt.Errorf("Failed to generate nonce: %w", err)) + panic(fmt.Errorf("failed to generate nonce: %w", err)) } nonce := hex.EncodeToString(nonceSeed[:]) diff --git a/database/middleware.go b/database/middleware.go index b7869b2d19724107555765c2649739cd2e8ae01a..0b23a99353b9fff71ff73762c885820f2144b1bc 100644 --- a/database/middleware.go +++ b/database/middleware.go @@ -32,7 +32,7 @@ func ForContext(ctx context.Context) (*sql.Conn, error) { raw, ok := ctx.Value(dbCtxKey).(*sql.DB) if !ok { - panic(errors.New("Invalid database context")) + panic(errors.New("invalid database context")) } return raw.Conn(ctx) } @@ -40,7 +40,7 @@ func DBForContext(ctx context.Context) *sql.DB { raw, ok := ctx.Value(dbCtxKey).(*sql.DB) if !ok { - panic(errors.New("Invalid database context")) + panic(errors.New("invalid database context")) } return raw } @@ -72,7 +72,7 @@ return err } if txErr != nil && txErr != sql.ErrTxDone { if err != nil { - panic(fmt.Errorf("Transaction error: %v\nClosure error: %v", txErr, err)) + panic(fmt.Errorf("transaction error: %v\nClosure error: %v", txErr, err)) } else { panic(txErr) } diff --git a/database/sq.go b/database/sq.go index 7891e318116c40b3411ab3c9ef8e2aa0b46f95a0..0e367593cc3b0b7aafde1cea8a083c24044fbd1e 100644 --- a/database/sq.go +++ b/database/sq.go @@ -100,7 +100,7 @@ } else { q = q.Columns(Columns(ctx, col)...) } default: - panic(fmt.Errorf("Unknown selectable type %T", col)) + panic(fmt.Errorf("unknown selectable type %T", col)) } } return q @@ -111,7 +111,7 @@ mf := m.Fields() mf.buildCache() var cols []string for col, fields := range mf.bySQL { - for _, _ = range fields { + for range fields { cols = append(cols, WithAlias(m.Alias(), col)) } } diff --git a/email/send.go b/email/send.go index f1018895196fe22dba8c2d66f1606601e50a5222..436378bc40615b4078d6a7e236ef610b18590663 100644 --- a/email/send.go +++ b/email/send.go @@ -37,14 +37,14 @@ panic(fmt.Errorf("[mail]smtp-port unset")) } mailconf.port, err = strconv.Atoi(portStr) if err != nil { - panic(fmt.Errorf("Unable to parse [mail]smtp-port (must be integer)")) + panic(fmt.Errorf("unable to parse [mail]smtp-port (must be integer)")) } if mailconf.host, ok = conf.Get("mail", "smtp-host"); !ok { - panic(fmt.Errorf("Missing SMTP configuration options [smtp-host]")) + panic(fmt.Errorf("missing SMTP configuration options [smtp-host]")) } if mailconf.from, ok = conf.Get("mail", "smtp-from"); !ok { - panic(fmt.Errorf("Missing SMTP configuration options [smtp-from]")) + panic(fmt.Errorf("missing SMTP configuration options [smtp-from]")) } sender, err := mail.ParseAddress(mailconf.from) @@ -57,7 +57,7 @@ switch enctype { case "starttls", "tls", "insecure": mailconf.enctype = enctype default: - panic(fmt.Errorf("Invalid SMTP configuration value for [smtp-encryption]")) + panic(fmt.Errorf("invalid SMTP configuration value for [smtp-encryption]")) } } @@ -66,15 +66,15 @@ switch authtype { case "none", "plain": mailconf.authtype = authtype default: - panic(fmt.Errorf("Invalid SMTP configuration value for [smtp-auth]")) + panic(fmt.Errorf("invalid SMTP configuration value for [smtp-auth]")) } } if mailconf.authtype == "plain" { if mailconf.user, ok = conf.Get("mail", "smtp-user"); !ok { - panic(fmt.Errorf("Missing SMTP configuration options [smtp-user]")) + panic(fmt.Errorf("missing SMTP configuration options [smtp-user]")) } if mailconf.pass, ok = conf.Get("mail", "smtp-password"); !ok { - panic(fmt.Errorf("Missing SMTP configuration options [smtp-password]")) + panic(fmt.Errorf("missing SMTP configuration options [smtp-password]")) } } diff --git a/email/worker.go b/email/worker.go index fb9cb89cdc46b2a709f89685cbc32126b34167aa..3e8874d22a8ca10c1632dd37b27ac1edbb41b495 100644 --- a/email/worker.go +++ b/email/worker.go @@ -68,7 +68,7 @@ if err != nil { return nil, err } if len(keyring) != 1 { - return nil, errors.New("Expected user PGP key to contain one key") + return nil, errors.New("expected user PGP key to contain one key") } rcptEntity := keyring[0] @@ -77,7 +77,7 @@ // pgpmail.Encrypt() returns a writer, and certain errors will only // occur once it is written to. _, ok := rcptEntity.EncryptionKey(time.Now()) if !ok { - return nil, fmt.Errorf("No valid encryption key found (expired?)") + return nil, fmt.Errorf("no valid encryption key found (expired?)") } return pgpmail.Encrypt(buf, header.Header.Header, @@ -222,19 +222,19 @@ // Creates a new email processing queue. func NewQueue(conf ini.File) *Queue { smtpFrom, ok := conf.Get("mail", "smtp-from") if !ok { - panic(fmt.Errorf("Expected [mail]smtp-from in config")) + panic(fmt.Errorf("expected [mail]smtp-from in config")) } ownerName, ok := conf.Get("sr.ht", "owner-name") if !ok { - panic(fmt.Errorf("Expected [sr.ht]owner-name in config")) + panic(fmt.Errorf("expected [sr.ht]owner-name in config")) } ownerEmail, ok := conf.Get("sr.ht", "owner-email") if !ok { - panic(fmt.Errorf("Expected [sr.ht]owner-email in config")) + panic(fmt.Errorf("expected [sr.ht]owner-email in config")) } addr, err := mail.ParseAddress(smtpFrom) if err != nil { - panic(fmt.Errorf("Invalid [mail]smtp-from: %s", err.Error())) + panic(fmt.Errorf("invalid [mail]smtp-from: %s", err.Error())) } ownerAddr := &mail.Address{ Name: ownerName, @@ -245,20 +245,20 @@ var entity *openpgp.Entity if privKeyPath, ok := conf.Get("mail", "pgp-privkey"); ok { privKeyFile, err := os.Open(privKeyPath) if err != nil { - panic(fmt.Errorf("Failed to open [mail]pgp-privkey: %v", err)) + panic(fmt.Errorf("failed to open [mail]pgp-privkey: %v", err)) } defer privKeyFile.Close() keyring, err := openpgp.ReadArmoredKeyRing(privKeyFile) if err != nil { - panic(fmt.Errorf("Failed to read PGP key ring from [mail]pgp-privkey: %v", err)) + panic(fmt.Errorf("failed to read PGP key ring from [mail]pgp-privkey: %v", err)) } if len(keyring) != 1 { - panic(fmt.Errorf("Expected [mail]pgp-privkey to contain one key")) + panic(fmt.Errorf("expected [mail]pgp-privkey to contain one key")) } entity = keyring[0] if entity.PrivateKey == nil || entity.PrivateKey.Encrypted { - panic(fmt.Errorf("Failed to load [mail]pgp-privkey for email signature")) + panic(fmt.Errorf("failed to load [mail]pgp-privkey for email signature")) } } @@ -276,7 +276,7 @@ // Returns the email worker for this context. func ForContext(ctx context.Context) *workerContext { q, ok := ctx.Value(emailCtxKey).(*workerContext) if !ok { - panic(errors.New("No email worker for this context")) + panic(errors.New("no email worker for this context")) } return q } diff --git a/model/cursor.go b/model/cursor.go index 8302fffd05ed7f3577e031e06c049188ce495b58..3123b13b2d3ce5c3f65c2e11e321a2dae8c09dd7 100644 --- a/model/cursor.go +++ b/model/cursor.go @@ -22,7 +22,7 @@ return fmt.Errorf("cursor must be strings") } plain := crypto.DecryptWithoutExpiration([]byte(enc)) if plain == nil { - return fmt.Errorf("Invalid cursor") + return fmt.Errorf("invalid cursor") } err := json.Unmarshal(plain, cur) if err != nil { diff --git a/objects/middleware.go b/objects/middleware.go index efdb4b57bffc601e90fc8e6e7c2871bc6eb5a20a..f19d74ed2cad11bc8e32aaaef2e7b9b1fe556f96 100644 --- a/objects/middleware.go +++ b/objects/middleware.go @@ -38,7 +38,7 @@ func ForContext(ctx context.Context) *s3.Client { raw, ok := ctx.Value(s3CtxKey).(*s3.Client) if !ok { - panic(fmt.Errorf("Invalid S3 context")) + panic(fmt.Errorf("invalid S3 context")) } return raw } diff --git a/redis/middleware.go b/redis/middleware.go index 295cd6a4bd0d006e5876114b539c14fb0a65b25a..350dee513dd5e1775633481c19bca6ab529bf2a0 100644 --- a/redis/middleware.go +++ b/redis/middleware.go @@ -31,7 +31,7 @@ func ForContext(ctx context.Context) redis.UniversalClient { raw, ok := ctx.Value(redisCtxKey).(redis.UniversalClient) if !ok { - panic(fmt.Errorf("Invalid redis context")) + panic(fmt.Errorf("invalid redis context")) } return raw } diff --git a/server/directives.go b/server/directives.go index 15f74bec80949b3e0e7ac7650471fb2b5c26a93c..87fca799dfe2297676bdd7311693c8cf6471b720 100644 --- a/server/directives.go +++ b/server/directives.go @@ -13,7 +13,7 @@ func Admin(ctx context.Context, obj any, next graphql.Resolver) (any, error) { if auth.ForContext(ctx).UserType != auth.USER_TYPE_ADMIN { - return nil, fmt.Errorf("Access denied") + return nil, fmt.Errorf("access denied") } return next(ctx) @@ -23,7 +23,7 @@ func AnonInternal(ctx context.Context, obj any, next graphql.Resolver) (any, error) { if auth.ForContext(ctx).AuthMethod != auth.AUTH_ANON_INTERNAL { - return nil, fmt.Errorf("Anonymous internal auth access denied") + return nil, fmt.Errorf("anonymous internal auth access denied") } return next(ctx) @@ -33,7 +33,7 @@ func Internal(ctx context.Context, obj any, next graphql.Resolver) (any, error) { if auth.ForContext(ctx).AuthMethod != auth.AUTH_INTERNAL { - return nil, fmt.Errorf("Internal auth access denied") + return nil, fmt.Errorf("internal auth access denied") } return next(ctx) @@ -48,12 +48,12 @@ case auth.AUTH_INTERNAL, auth.AUTH_COOKIE: return next(ctx) case auth.AUTH_OAUTH2: if user.BearerToken.ClientID != "" { - return nil, fmt.Errorf("Private auth access denied") + return nil, fmt.Errorf("private auth access denied") } return next(ctx) } - return nil, fmt.Errorf("Private auth access denied") + return nil, fmt.Errorf("private auth access denied") } func Access(ctx context.Context, obj any, next graphql.Resolver, diff --git a/server/server.go b/server/server.go index 5f313d19722e4a291dc5c34680326ff39904a51d..302162a7cb278d615e2b2523cb0c88bd84e23768 100644 --- a/server/server.go +++ b/server/server.go @@ -294,7 +294,7 @@ addr := r.RemoteAddr if net.ParseIP(addr) == nil { addr, _, err = net.SplitHostPort(addr) if err != nil { - panic(fmt.Errorf("Invalid remote address: %s", r.RemoteAddr)) + panic(fmt.Errorf("invalid remote address: %s", r.RemoteAddr)) } } ctx := context.WithValue(r.Context(), serverCtxKey, server) @@ -312,7 +312,7 @@ // be valid input for `net.ParseIP()`. func RemoteAddr(ctx context.Context) string { raw, ok := ctx.Value(remoteAddrCtxKey).(string) if !ok { - panic(fmt.Errorf("Invalid authentication context")) + panic(fmt.Errorf("invalid authentication context")) } return raw } @@ -320,7 +320,7 @@ func ForContext(ctx context.Context) *Server { raw, ok := ctx.Value(serverCtxKey).(*Server) if !ok { - panic(fmt.Errorf("Invalid server context")) + panic(fmt.Errorf("invalid server context")) } return raw } diff --git a/valid/valid.go b/valid/valid.go index 994e4b41144d87d3eb871279bffa0dcc9f4b37a3..67a380dc1610e733365d92b6644c1979aff008f5 100644 --- a/valid/valid.go +++ b/valid/valid.go @@ -64,7 +64,7 @@ // the function is called with the value for the user to conduct further // validation with. func (valid *Validation) Optional(name string, fn func(i any)) { if valid.input == nil { - panic(fmt.Errorf("Attempted to validate fields without input")) + panic(fmt.Errorf("attempted to validate fields without input")) } if o, ok := valid.input[name]; ok { if o == nil { @@ -80,7 +80,7 @@ // present, but not a string, an error is recorded. Otherwise, the function is // called with the string for the user to conduct further validation with. func (valid *Validation) OptionalString(name string, fn func(s string)) { if valid.input == nil { - panic(fmt.Errorf("Attempted to validate fields without input")) + panic(fmt.Errorf("attempted to validate fields without input")) } if o, ok := valid.input[name]; ok { if o == nil { @@ -109,7 +109,7 @@ // the function is called with the string for the user to conduct further // validation with. func (valid *Validation) NullableString(name string, fn func(s *string)) { if valid.input == nil { - panic(fmt.Errorf("Attempted to validate fields without input")) + panic(fmt.Errorf("attempted to validate fields without input")) } if o, ok := valid.input[name]; ok { var val *string @@ -136,7 +136,7 @@ // present, but not a boolean, an error is recorded. Otherwise, the function is // called with the boolean for the user to conduct further validation with. func (valid *Validation) OptionalBool(name string, fn func(b bool)) { if valid.input == nil { - panic(fmt.Errorf("Attempted to validate fields without input")) + panic(fmt.Errorf("attempted to validate fields without input")) } if o, ok := valid.input[name]; ok { if o == nil { diff --git a/webhooks/config.go b/webhooks/config.go index 883d4d34c95e87a23ab45bc2184c4dd0033177b6..717dca32f415af6eda47ff7fd43da9cd6624069e 100644 --- a/webhooks/config.go +++ b/webhooks/config.go @@ -50,7 +50,7 @@ ClientID: clientID, }, nil case auth.AUTH_COOKIE: // TODO: Should this work? - return AuthConfig{}, fmt.Errorf("Native webhooks are not supported with web authentication") + return AuthConfig{}, fmt.Errorf("native webhooks are not supported with web authentication") case auth.AUTH_INTERNAL: nodeID := config.ServiceName(ctx) return AuthConfig{ @@ -58,9 +58,9 @@ AuthMethod: user.AuthMethod, NodeID: &nodeID, }, nil case auth.AUTH_WEBHOOK: - panic(fmt.Errorf("Recursive webhook auth is not supported")) + panic(fmt.Errorf("recursive webhook auth is not supported")) } - panic(fmt.Errorf("Unreachable")) + panic(fmt.Errorf("unreachable")) } // Returns an SQL expression to filter webhooks for the authenticated user. diff --git a/webhooks/context.go b/webhooks/context.go index a8a109c3e7756e48ff7e7db093c1cd1da885b322..a3dd067f464698d8255275a6b65611938c8c580a 100644 --- a/webhooks/context.go +++ b/webhooks/context.go @@ -40,7 +40,7 @@ // Returns the active payload for a webhook context. func Payload(ctx context.Context) (any, error) { payload := ctx.Value(payloadContextKey) if payload == nil { - return nil, errors.New("Cannot use this resolver without an active webhook context") + return nil, errors.New("cannot use this resolver without an active webhook context") } return payload, nil } @@ -81,7 +81,7 @@ if err != nil { panic(err) } default: - panic(fmt.Errorf("Unsupported authentication context for webhook")) + panic(fmt.Errorf("unsupported authentication context for webhook")) } exec := executor.New(schema) @@ -134,7 +134,7 @@ } ctx := graphql.StartOperationTrace(context.TODO()) _, errors := exec.CreateOperationContext(ctx, ¶ms) if errors != nil { - return fmt.Errorf("Error validating webhook query: %s", errors.Error()) + return fmt.Errorf("error validating webhook query: %s", errors.Error()) } return nil } diff --git a/webhooks/legacy.go b/webhooks/legacy.go index be8d98b8ea4f9a5c990ccf315c62bf89b69e006f..e9c47bb6623b0356f583a4da0a2d170bb62d3e3e 100644 --- a/webhooks/legacy.go +++ b/webhooks/legacy.go @@ -228,7 +228,7 @@ reader := io.LimitReader(resp.Body, 65536) // No more than 64 KiB body, err := io.ReadAll(reader) if err != nil { - return fmt.Errorf("Error reading response body: %v: %w", + return fmt.Errorf("error reading response body: %v: %w", err, work.ErrDoNotReattempt) } @@ -255,7 +255,7 @@ if resp.StatusCode == http.StatusBadGateway || resp.StatusCode == http.StatusServiceUnavailable || resp.StatusCode == http.StatusGatewayTimeout { // Retry - return fmt.Errorf("Server returned status %d: %s", + return fmt.Errorf("server returned status %d: %s", resp.StatusCode, resp.Status) } diff --git a/webhooks/middleware.go b/webhooks/middleware.go index de34b4436c6b3075e0ad2016041f458914d6e582..b488ca80200a899c474965b6393b9f63fd7678c9 100644 --- a/webhooks/middleware.go +++ b/webhooks/middleware.go @@ -21,7 +21,7 @@ func ForContext(ctx context.Context) *WebhookQueue { queue, ok := ctx.Value(ctxKey).(*WebhookQueue) if !ok { - panic(fmt.Errorf("No webhook queue for this context")) + panic(fmt.Errorf("no webhook queue for this context")) } return queue } @@ -41,7 +41,7 @@ func LegacyForContext(ctx context.Context) *LegacyQueue { queue, ok := ctx.Value(legacyCtxKey).(*LegacyQueue) if !ok { - panic(fmt.Errorf("No legacy webhook queue for this context")) + panic(fmt.Errorf("no legacy webhook queue for this context")) } return queue } diff --git a/webhooks/queue.go b/webhooks/queue.go index e84fbf7ec900494ed0e50afaf85df9f2187ed355..96983d4d204e85d1dede1ad3b83ab5ab855452d3 100644 --- a/webhooks/queue.go +++ b/webhooks/queue.go @@ -242,7 +242,7 @@ reader := io.LimitReader(resp.Body, 262144) // No more than 256 KiB body, err := io.ReadAll(reader) if err != nil { - return fmt.Errorf("Error reading response body: %v: %w", + return fmt.Errorf("error reading response body: %v: %w", err, work.ErrDoNotReattempt) } @@ -267,7 +267,7 @@ if resp.StatusCode == http.StatusBadGateway || resp.StatusCode == http.StatusServiceUnavailable || resp.StatusCode == http.StatusGatewayTimeout { // Retry - return fmt.Errorf("Server returned status %d: %s", + return fmt.Errorf("server returned status %d: %s", resp.StatusCode, resp.Status) }