crusader@loafle.com abaf9c217a WebSocket client
2017-08-10 16:39:58 +09:00

31 lines
895 B
Go

package protocol
import "errors"
// ErrorCode is type when used to communicate with WebSocket RPC
type ErrorCode int
const (
// EParse is error code that is invalid json
EParse ErrorCode = -32700
// EInvalidReq is error code that is invalid request
EInvalidReq ErrorCode = -32600
// ENotFoundMethod is error code that is not exist method
ENotFoundMethod ErrorCode = -32601
// EInvalidParams is error code that is invalid parameters
EInvalidParams ErrorCode = -32602
// EInternal is error code that is internel error
EInternal ErrorCode = -32603
// EServer is error code that is server error
EServer ErrorCode = -32000
)
var ErrNullResult = errors.New("result is null")
// Error is error struct when used to communicate with WebSocket RPC
type Error struct {
Code ErrorCode `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}