Skip to content

Commit f02ed52

Browse files
committed
rpc: also move Error to errors.go
1 parent 2f3b97f commit f02ed52

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

rpc/errors.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ func (err HTTPError) Error() string {
3333
return fmt.Sprintf("%v: %s", err.Status, err.Body)
3434
}
3535

36+
// Error wraps RPC errors, which contain an error code in addition to the message.
37+
type Error interface {
38+
Error() string // returns the message
39+
ErrorCode() int // returns the code
40+
}
41+
42+
// A DataError contains some data in addition to the error message.
43+
type DataError interface {
44+
Error() string // returns the message
45+
ErrorData() interface{} // returns the error data
46+
}
47+
3648
// Error types defined below are the built-in JSON-RPC errors.
3749

3850
var (

rpc/types.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,6 @@ type API struct {
3535
Public bool // indication if the methods must be considered safe for public use
3636
}
3737

38-
// Error wraps RPC errors, which contain an error code in addition to the message.
39-
type Error interface {
40-
Error() string // returns the message
41-
ErrorCode() int // returns the code
42-
}
43-
44-
// A DataError contains some data in addition to the error message.
45-
type DataError interface {
46-
Error() string // returns the message
47-
ErrorData() interface{} // returns the error data
48-
}
49-
5038
// ServerCodec implements reading, parsing and writing RPC messages for the server side of
5139
// a RPC session. Implementations must be go-routine safe since the codec can be called in
5240
// multiple go-routines concurrently.

0 commit comments

Comments
 (0)