edge/pkg/module/rpc/jsonrpc.go

20 lines
344 B
Go
Raw Permalink Normal View History

2023-11-28 16:35:49 +01:00
package rpc
import "fmt"
type JSONRPCRequest struct {
ID any
Method string
Params any
}
type JSONRPCError struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data"`
}
func (e *JSONRPCError) Error() string {
return fmt.Sprintf("json-rpc error: %d - %s", e.Code, e.Message)
}