File tree Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Expand file tree Collapse file tree 2 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -96,17 +96,17 @@ func (msg *Response) marshal(to *wireCombined) {
96
96
to .Result = msg .Result
97
97
}
98
98
99
- func toWireError (err error ) * wireError {
99
+ func toWireError (err error ) * WireError {
100
100
if err == nil {
101
101
// no error, the response is complete
102
102
return nil
103
103
}
104
- if err , ok := err .(* wireError ); ok {
104
+ if err , ok := err .(* WireError ); ok {
105
105
// already a wire error, just use it
106
106
return err
107
107
}
108
- result := & wireError {Message : err .Error ()}
109
- var wrapped * wireError
108
+ result := & WireError {Message : err .Error ()}
109
+ var wrapped * WireError
110
110
if errors .As (err , & wrapped ) {
111
111
// if we wrapped a wire error, keep the code from the wrapped error
112
112
// but the message from the outer error
Original file line number Diff line number Diff line change @@ -49,11 +49,11 @@ type wireCombined struct {
49
49
Method string `json:"method,omitempty"`
50
50
Params json.RawMessage `json:"params,omitempty"`
51
51
Result json.RawMessage `json:"result,omitempty"`
52
- Error * wireError `json:"error,omitempty"`
52
+ Error * WireError `json:"error,omitempty"`
53
53
}
54
54
55
- // wireError represents a structured error in a Response.
56
- type wireError struct {
55
+ // WireError represents a structured error in a Response.
56
+ type WireError struct {
57
57
// Code is an error code indicating the type of failure.
58
58
Code int64 `json:"code"`
59
59
// Message is a short description of the error.
@@ -67,18 +67,18 @@ type wireError struct {
67
67
// only be used to build errors for application specific codes as allowed by the
68
68
// specification.
69
69
func NewError (code int64 , message string ) error {
70
- return & wireError {
70
+ return & WireError {
71
71
Code : code ,
72
72
Message : message ,
73
73
}
74
74
}
75
75
76
- func (err * wireError ) Error () string {
76
+ func (err * WireError ) Error () string {
77
77
return err .Message
78
78
}
79
79
80
- func (err * wireError ) Is (other error ) bool {
81
- w , ok := other .(* wireError )
80
+ func (err * WireError ) Is (other error ) bool {
81
+ w , ok := other .(* WireError )
82
82
if ! ok {
83
83
return false
84
84
}
You can’t perform that action at this time.
0 commit comments