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

mendersoftware / iot-manager / 1401702106

05 Aug 2024 08:32PM UTC coverage: 87.577%. Remained the same
1401702106

push

gitlab-ci

web-flow
Merge pull request #295 from mendersoftware/dependabot/docker/docker-dependencies-03b04ac819

chore: bump golang from 1.22.4-alpine3.19 to 1.22.5-alpine3.19 in the docker-dependencies group

3264 of 3727 relevant lines covered (87.58%)

11.44 hits per line

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

100.0
/model/errstack.go
1
// Copyright 2022 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
package model
16

17
import (
18
        "errors"
19
        "strings"
20
)
21

22
type ErrorStack []error
23

24
func (stack ErrorStack) Is(target error) bool {
3✔
25
        for _, err := range stack {
9✔
26
                if errors.Is(err, target) {
8✔
27
                        return true
2✔
28
                }
2✔
29
        }
30
        return false
1✔
31
}
32

33
func (stack ErrorStack) As(target interface{}) bool {
2✔
34
        for _, err := range stack {
6✔
35
                if errors.As(err, target) {
5✔
36
                        return true
1✔
37
                }
1✔
38
        }
39
        return false
1✔
40
}
41

42
func (stack *ErrorStack) Push(err error) *ErrorStack {
3✔
43
        *stack = append(*stack, err)
3✔
44
        return stack
3✔
45
}
3✔
46

47
func (stack ErrorStack) Error() string {
3✔
48
        var (
3✔
49
                strBldr strings.Builder
3✔
50
                lim     = len(stack) - 1
3✔
51
        )
3✔
52
        for i, err := range stack {
12✔
53
                strBldr.WriteString(err.Error())
9✔
54
                if i < lim {
15✔
55
                        strBldr.WriteString("; ")
6✔
56
                }
6✔
57
        }
58
        return strBldr.String()
3✔
59
}
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

© 2025 Coveralls, Inc