• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

opendefensecloud / artifact-conduit / 19506869055

19 Nov 2025 03:31PM UTC coverage: 53.005%. First build
19506869055

Pull #48

github

web-flow
Merge d04e64e10 into 595ac615a
Pull Request #48: Handle different log text length

0 of 13 new or added lines in 1 file covered. (0.0%)

291 of 549 relevant lines covered (53.01%)

11.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/pkg/controller/errors.go
1
// Copyright 2025 BWI GmbH and Artifact Conduit contributors
2
// SPDX-License-Identifier: Apache-2.0
3

4
package controller
5

6
import (
7
        "fmt"
8
        "strings"
9

10
        "github.com/go-logr/logr"
11
)
12

13
// errLogAndWrap is a small utility function to reduce code and be able to directly
14
// return errors, but wrap them and log them at the same time. It also capitalizes the
15
// first letter as well. Short texts will be handled.
NEW
16
func errLogAndWrap(log logr.Logger, err error, text string) error {
×
NEW
17
        textLen := len(text)
×
NEW
18
        switch textLen {
×
NEW
19
        case 0:
×
NEW
20
                return err
×
NEW
21
        case 1:
×
NEW
22
                logText := strings.ToUpper(text)
×
NEW
23
                log.Error(err, logText)
×
NEW
24
                return fmt.Errorf(text+": %w", err)
×
NEW
25
        default:
×
NEW
26
                logText := strings.ToUpper(text[:1]) + text[1:]
×
NEW
27
                log.Error(err, logText)
×
NEW
28
                return fmt.Errorf(text+": %w", err)
×
29
        }
30
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc