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

lightningnetwork / lnd / 13043384202

30 Jan 2025 12:49AM UTC coverage: 48.841% (-9.9%) from 58.777%
13043384202

Pull #9459

github

ziggie1984
docs: add release notes.
Pull Request #9459: invoices: amp invoices bugfix.

28 of 45 new or added lines in 3 files covered. (62.22%)

28177 existing lines in 437 files now uncovered.

99712 of 204157 relevant lines covered (48.84%)

1.02 hits per line

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

94.74
/graph/errors.go
1
package graph
2

3
import "github.com/go-errors/errors"
4

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

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

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

19
        // ErrChannelSpent is returned when we go to validate a channel, but
20
        // the purported funding output has actually already been spent on
21
        // chain.
22
        ErrChannelSpent
23

24
        // ErrNoFundingTransaction is returned when we are unable to find the
25
        // funding transaction described by the short channel ID on chain.
26
        ErrNoFundingTransaction
27

28
        // ErrInvalidFundingOutput is returned if the channel funding output
29
        // fails validation.
30
        ErrInvalidFundingOutput
31
)
32

33
// Error is a structure that represent the error inside the graph package,
34
// this structure carries additional information about error code in order to
35
// be able distinguish errors outside of the current package.
36
type Error struct {
37
        err  *errors.Error
38
        code ErrorCode
39
}
40

41
// Error represents errors as the string
42
// NOTE: Part of the error interface.
43
func (e *Error) Error() string {
2✔
44
        return e.err.Error()
2✔
45
}
2✔
46

47
// A compile time check to ensure Error implements the error interface.
48
var _ error = (*Error)(nil)
49

50
// NewErrf creates a Error by the given error formatted description and
51
// its corresponding error code.
52
func NewErrf(code ErrorCode, format string, a ...interface{}) *Error {
2✔
53
        return &Error{
2✔
54
                code: code,
2✔
55
                err:  errors.Errorf(format, a...),
2✔
56
        }
2✔
57
}
2✔
58

59
// IsError is a helper function which is needed to have ability to check that
60
// returned error has specific error code.
61
func IsError(e interface{}, codes ...ErrorCode) bool {
2✔
62
        err, ok := e.(*Error)
2✔
63
        if !ok {
4✔
64
                return false
2✔
65
        }
2✔
66

67
        for _, code := range codes {
4✔
68
                if err.code == code {
4✔
69
                        return true
2✔
70
                }
2✔
71
        }
72

UNCOV
73
        return false
×
74
}
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