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

lightningnetwork / lnd / 13586005509

28 Feb 2025 10:14AM UTC coverage: 68.629% (+9.9%) from 58.77%
13586005509

Pull #9521

github

web-flow
Merge 37d3a70a5 into 8532955b3
Pull Request #9521: unit: remove GOACC, use Go 1.20 native coverage functionality

129950 of 189351 relevant lines covered (68.63%)

23726.46 hits per line

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

85.71
/watchtower/wtwire/error.go
1
package wtwire
2

3
import "io"
4

5
// Error is a generic error message that can be sent to a client if a request
6
// fails outside of prescribed protocol errors. Typically this would be followed
7
// by the server disconnecting the client, and so can be useful to transferring
8
// the exact reason.
9
type Error struct {
10
        // Code specifies the error code encountered by the server.
11
        Code ErrorCode
12

13
        // Data encodes a payload whose contents can be interpreted by the
14
        // client in response to the error code.
15
        Data []byte
16
}
17

18
// NewError returns an freshly-initialized Error message.
19
func NewError() *Error {
×
20
        return &Error{}
×
21
}
×
22

23
// A compile time check to ensure Error implements the wtwire.Message interface.
24
var _ Message = (*Error)(nil)
25

26
// Decode deserializes a serialized Error message stored in the passed io.Reader
27
// observing the specified protocol version.
28
//
29
// This is part of the wtwire.Message interface.
30
func (e *Error) Decode(r io.Reader, pver uint32) error {
125✔
31
        return ReadElements(r,
125✔
32
                &e.Code,
125✔
33
                &e.Data,
125✔
34
        )
125✔
35
}
125✔
36

37
// Encode serializes the target Error into the passed io.Writer observing the
38
// protocol version specified.
39
//
40
// This is part of the wtwire.Message interface.
41
func (e *Error) Encode(w io.Writer, prver uint32) error {
105✔
42
        return WriteElements(w,
105✔
43
                e.Code,
105✔
44
                e.Data,
105✔
45
        )
105✔
46
}
105✔
47

48
// MsgType returns the integer uniquely identifying this message type on the
49
// wire.
50
//
51
// This is part of the wtwire.Message interface.
52
func (e *Error) MsgType() MessageType {
125✔
53
        return MsgError
125✔
54
}
125✔
55

56
// MaxPayloadLength returns the maximum allowed payload size for a Error
57
// complete message observing the specified protocol version.
58
//
59
// This is part of the wtwire.Message interface.
60
func (e *Error) MaxPayloadLength(uint32) uint32 {
225✔
61
        return MaxMessagePayload
225✔
62
}
225✔
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