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

lightningnetwork / lnd / 16683051882

01 Aug 2025 07:03PM UTC coverage: 54.949% (-12.1%) from 67.047%
16683051882

Pull #9455

github

web-flow
Merge 3f1f50be8 into 37523b6cb
Pull Request #9455: discovery+lnwire: add support for DNS host name in NodeAnnouncement msg

144 of 226 new or added lines in 7 files covered. (63.72%)

23852 existing lines in 290 files now uncovered.

108751 of 197912 relevant lines covered (54.95%)

22080.83 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