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

lightningnetwork / lnd / 16181619122

09 Jul 2025 10:33PM UTC coverage: 55.326% (-2.3%) from 57.611%
16181619122

Pull #10060

github

web-flow
Merge d15e8671f into 0e830da9d
Pull Request #10060: sweep: fix expected spending events being missed

9 of 26 new or added lines in 2 files covered. (34.62%)

23695 existing lines in 280 files now uncovered.

108518 of 196143 relevant lines covered (55.33%)

22354.81 hits per line

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

78.95
/graph/errors.go
1
package graph
2

3
import (
4
        "fmt"
5
)
6

7
// ErrorCode is used to represent the various errors that can occur within this
8
// package.
9
type ErrorCode uint8
10

11
const (
12
        // ErrOutdated is returned when the routing update already have
13
        // been applied, or a newer update is already known.
14
        ErrOutdated ErrorCode = iota
15

16
        // ErrIgnored is returned when the update have been ignored because
17
        // this update can't bring us something new, or because a node
18
        // announcement was given for node not found in any channel.
19
        ErrIgnored
20
)
21

22
// Error is a structure that represent the error inside the graph package,
23
// this structure carries additional information about error code in order to
24
// be able distinguish errors outside of the current package.
25
type Error struct {
26
        err  error
27
        code ErrorCode
28
}
29

30
// Error represents errors as the string
31
// NOTE: Part of the error interface.
UNCOV
32
func (e *Error) Error() string {
×
UNCOV
33
        return e.err.Error()
×
UNCOV
34
}
×
35

36
// A compile time check to ensure Error implements the error interface.
37
var _ error = (*Error)(nil)
38

39
// NewErrf creates a Error by the given error formatted description and
40
// its corresponding error code.
41
func NewErrf(code ErrorCode, format string, a ...interface{}) *Error {
3✔
42
        return &Error{
3✔
43
                code: code,
3✔
44
                err:  fmt.Errorf(format, a...),
3✔
45
        }
3✔
46
}
3✔
47

48
// IsError is a helper function which is needed to have ability to check that
49
// returned error has specific error code.
50
func IsError(e interface{}, codes ...ErrorCode) bool {
5✔
51
        err, ok := e.(*Error)
5✔
52
        if !ok {
6✔
53
                return false
1✔
54
        }
1✔
55

56
        for _, code := range codes {
8✔
57
                if err.code == code {
8✔
58
                        return true
4✔
59
                }
4✔
60
        }
61

62
        return false
×
63
}
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