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

lightningnetwork / lnd / 13236757158

10 Feb 2025 08:39AM UTC coverage: 57.649% (-1.2%) from 58.815%
13236757158

Pull #9493

github

ziggie1984
lncli: for some cmds we don't replace the data of the response.

For some cmds it is not very practical to replace the json output
because we might pipe it into other commands. For example when
creating the route we want to pipe it into sendtoRoute.
Pull Request #9493: For some lncli cmds we should not replace the content with other data

0 of 9 new or added lines in 2 files covered. (0.0%)

19535 existing lines in 252 files now uncovered.

103517 of 179563 relevant lines covered (57.65%)

24878.49 hits per line

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

84.21
/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.
UNCOV
43
func (e *Error) Error() string {
×
UNCOV
44
        return e.err.Error()
×
UNCOV
45
}
×
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 {
207✔
53
        return &Error{
207✔
54
                code: code,
207✔
55
                err:  errors.Errorf(format, a...),
207✔
56
        }
207✔
57
}
207✔
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 {
617✔
62
        err, ok := e.(*Error)
617✔
63
        if !ok {
620✔
64
                return false
3✔
65
        }
3✔
66

67
        for _, code := range codes {
1,432✔
68
                if err.code == code {
1,227✔
69
                        return true
409✔
70
                }
409✔
71
        }
72

73
        return false
205✔
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