diff options
author | bas-vk <bas-vk@users.noreply.github.com> | 2016-07-25 16:07:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-25 16:07:05 +0800 |
commit | 771655e3fee585ce4bc47dfaa279557c6c1c2421 (patch) | |
tree | 9071e157a54c40f06f0e5895643c82ca9a0b037a /rpc/errors.go | |
parent | 60cd5bf9397bd8331bce3bb1884524d43c31dbb5 (diff) | |
parent | 91b769042857f542b2792b23ec407e1c9bd4fe8d (diff) | |
download | go-tangerine-771655e3fee585ce4bc47dfaa279557c6c1c2421.tar go-tangerine-771655e3fee585ce4bc47dfaa279557c6c1c2421.tar.gz go-tangerine-771655e3fee585ce4bc47dfaa279557c6c1c2421.tar.bz2 go-tangerine-771655e3fee585ce4bc47dfaa279557c6c1c2421.tar.lz go-tangerine-771655e3fee585ce4bc47dfaa279557c6c1c2421.tar.xz go-tangerine-771655e3fee585ce4bc47dfaa279557c6c1c2421.tar.zst go-tangerine-771655e3fee585ce4bc47dfaa279557c6c1c2421.zip |
Merge pull request #2808 from fjl/rpc-client-3
rpc: add new client, use it everywhere
Diffstat (limited to 'rpc/errors.go')
-rw-r--r-- | rpc/errors.go | 63 |
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" } |