aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/errors.go
diff options
context:
space:
mode:
Diffstat (limited to 'rpc/errors.go')
-rw-r--r--rpc/errors.go63
1 files changed, 16 insertions, 47 deletions
diff --git a/rpc/errors.go b/rpc/errors.go
index bc352fc45..9cf9dc60c 100644
--- a/rpc/errors.go
+++ b/rpc/errors.go
@@ -24,74 +24,43 @@ type methodNotFoundError struct {
method string
}
-func (e *methodNotFoundError) Code() int {
- return -32601
-}
+func (e *methodNotFoundError) ErrorCode() int { return -32601 }
func (e *methodNotFoundError) Error() string {
return fmt.Sprintf("The method %s%s%s does not exist/is not available", e.service, serviceMethodSeparator, e.method)
}
// received message isn't a valid request
-type invalidRequestError struct {
- message string
-}
+type invalidRequestError struct{ message string }
-func (e *invalidRequestError) Code() int {
- return -32600
-}
+func (e *invalidRequestError) ErrorCode() int { return -32600 }
-func (e *invalidRequestError) Error() string {
- return e.message
-}
+func (e *invalidRequestError) Error() string { return e.message }
// received message is invalid
-type invalidMessageError struct {
- message string
-}
+type invalidMessageError struct{ message string }
-func (e *invalidMessageError) Code() int {
- return -32700
-}
+func (e *invalidMessageError) ErrorCode() int { return -32700 }
-func (e *invalidMessageError) Error() string {
- return e.message
-}
+func (e *invalidMessageError) Error() string { return e.message }
// unable to decode supplied params, or an invalid number of parameters
-type invalidParamsError struct {
- message string
-}
+type invalidParamsError struct{ message string }
-func (e *invalidParamsError) Code() int {
- return -32602
-}
+func (e *invalidParamsError) ErrorCode() int { return -32602 }
-func (e *invalidParamsError) Error() string {
- return e.message
-}
+func (e *invalidParamsError) Error() string { return e.message }
// logic error, callback returned an error
-type callbackError struct {
- message string
-}
+type callbackError struct{ message string }
-func (e *callbackError) Code() int {
- return -32000
-}
+func (e *callbackError) ErrorCode() int { return -32000 }
-func (e *callbackError) Error() string {
- return e.message
-}
+func (e *callbackError) Error() string { return e.message }
// issued when a request is received after the server is issued to stop.
-type shutdownError struct {
-}
+type shutdownError struct{}
-func (e *shutdownError) Code() int {
- return -32000
-}
+func (e *shutdownError) ErrorCode() int { return -32000 }
-func (e *shutdownError) Error() string {
- return "server is shutting down"
-}
+func (e *shutdownError) Error() string { return "server is shutting down" }