1 Star 0 Fork 0

golangx / jsonrpc

Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
Clone or download
error.go 1.52 KB
Copy Edit Raw Blame History
luohancai authored 2020-06-19 08:44 . 添加日志和错误
package jsonrpc
const (
// ParseError Parse error
// Invalid JSON was received by the server.
ParseError = -32600
)
// ParseError JSON解析错误
// func ParseError() RPCError {
// return RPCError{
// Code: -32600,
// Message: "Parse error",
// Data: "Invalid JSON was received by the server.",
// }
// }
/**
-------------------------------------------
-----------------------------------------
*/
// // ParseError JSON解析错误
// const ParseError error = &RPCError{
// Code: -32600,
// Message: "Parse error",
// Data: "Invalid JSON was received by the server.",
// }
// InvalidRequest JSON解析错误
func InvalidRequest() RPCError {
return RPCError{
Code: -32600,
Message: "Invalid Request",
Data: "The JSON sent is not a valid Request object.",
}
}
// MethodNotFound JSON解析错误
func MethodNotFound() RPCError {
return RPCError{
Code: -32600,
Message: "Method not found",
Data: "The method does not exist / is not available.",
}
}
// InvalidParams JSON解析错误
func InvalidParams() RPCError {
return RPCError{
Code: -32600,
Message: "Invalid params",
Data: "Invalid method parameter(s).",
}
}
// InternalError JSON解析错误
func InternalError() RPCError {
return RPCError{
Code: -32603,
Message: "Internal error",
Data: "Internal JSON-RPC error.",
}
}
// ServerError JSON解析错误
func ServerError() RPCError {
return RPCError{
Code: -32000,
Message: "Server error",
Data: "Reserved for implementation-defined server-errors.",
}
}

Comment ( 0 )

Sign in for post a comment

Go
1
https://gitee.com/golangx/jsonrpc.git
git@gitee.com:golangx/jsonrpc.git
golangx
jsonrpc
jsonrpc
v1.0.5

Search