Skip to content

Commit d9addf7

Browse files
author
Gustav Simonsson
committed
Improve error string and remove unneeded else clause
1 parent 8292013 commit d9addf7

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

‎miner/remote_agent.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ func (a *RemoteAgent) GetWork() ([3]string, error) {
112112

113113
a.work[block.HashNoNonce()] = a.currentWork
114114
return res, nil
115-
} else {
116-
return res, errors.New("No work available yet, don't panic.")
117115
}
116+
return res, errors.New("No work available yet, don't panic.")
118117
}
119118

120119
// Returns true or false, but does not indicate if the PoW was correct

‎rpc/api/eth.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ func (self *ethApi) GetWork(req *shared.Request) (interface{}, error) {
565565
self.xeth.SetMining(true, 0)
566566
ret, err := self.xeth.RemoteMining().GetWork()
567567
if err != nil {
568-
return nil, shared.NewNotReadyError("getWork")
568+
return nil, shared.NewNotReadyError("mining work")
569569
} else {
570570
return ret, nil
571571
}

‎rpc/shared/errors.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ func NewNotImplementedError(method string) *NotImplementedError {
6565
}
6666

6767
type NotReadyError struct {
68-
Method string
68+
Resource string
6969
}
7070

7171
func (e *NotReadyError) Error() string {
72-
return fmt.Sprintf("%s method not ready", e.Method)
72+
return fmt.Sprintf("%s not ready", e.Resource)
7373
}
7474

75-
func NewNotReadyError(method string) *NotReadyError {
75+
func NewNotReadyError(resource string) *NotReadyError {
7676
return &NotReadyError{
77-
Method: method,
77+
Resource: resource,
7878
}
7979
}
8080

0 commit comments

Comments
 (0)