rpc: add HTTPError type for HTTP error responses (#22677)
The new error type is returned by client operations contains details of the response error code and response body. Co-authored-by: Felix Lange <fjl@twurst.com>
This commit is contained in:
12
rpc/types.go
12
rpc/types.go
@ -35,18 +35,6 @@ type API struct {
|
||||
Public bool // indication if the methods must be considered safe for public use
|
||||
}
|
||||
|
||||
// Error wraps RPC errors, which contain an error code in addition to the message.
|
||||
type Error interface {
|
||||
Error() string // returns the message
|
||||
ErrorCode() int // returns the code
|
||||
}
|
||||
|
||||
// A DataError contains some data in addition to the error message.
|
||||
type DataError interface {
|
||||
Error() string // returns the message
|
||||
ErrorData() interface{} // returns the error data
|
||||
}
|
||||
|
||||
// ServerCodec implements reading, parsing and writing RPC messages for the server side of
|
||||
// a RPC session. Implementations must be go-routine safe since the codec can be called in
|
||||
// multiple go-routines concurrently.
|
||||
|
Reference in New Issue
Block a user