From 829201382b67e95ab31fca887234d1858c11c810 Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Wed, 26 Aug 2015 12:46:50 +0200 Subject: rpc: return error code for eth_getWork when no work ready --- rpc/shared/errors.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'rpc/shared/errors.go') diff --git a/rpc/shared/errors.go b/rpc/shared/errors.go index 85af1bb2f..d43858a40 100644 --- a/rpc/shared/errors.go +++ b/rpc/shared/errors.go @@ -64,6 +64,20 @@ func NewNotImplementedError(method string) *NotImplementedError { } } +type NotReadyError struct { + Method string +} + +func (e *NotReadyError) Error() string { + return fmt.Sprintf("%s method not ready", e.Method) +} + +func NewNotReadyError(method string) *NotReadyError { + return &NotReadyError{ + Method: method, + } +} + type DecodeParamError struct { err string } -- cgit v1.2.3 From d9addf79fadfed85a7437184aa3ab12622eb5d13 Mon Sep 17 00:00:00 2001 From: Gustav Simonsson Date: Fri, 28 Aug 2015 03:42:01 +0200 Subject: Improve error string and remove unneeded else clause --- rpc/shared/errors.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'rpc/shared/errors.go') diff --git a/rpc/shared/errors.go b/rpc/shared/errors.go index d43858a40..d5a7011f9 100644 --- a/rpc/shared/errors.go +++ b/rpc/shared/errors.go @@ -65,16 +65,16 @@ func NewNotImplementedError(method string) *NotImplementedError { } type NotReadyError struct { - Method string + Resource string } func (e *NotReadyError) Error() string { - return fmt.Sprintf("%s method not ready", e.Method) + return fmt.Sprintf("%s not ready", e.Resource) } -func NewNotReadyError(method string) *NotReadyError { +func NewNotReadyError(resource string) *NotReadyError { return &NotReadyError{ - Method: method, + Resource: resource, } } -- cgit v1.2.3