[#609] morph/client: Make halt state error private

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-06-15 16:47:57 +03:00 committed by Alex Vanin
parent 0ec3faefc9
commit 08b5f29e16
2 changed files with 5 additions and 5 deletions

View file

@ -51,11 +51,11 @@ var ErrNilClient = errors.New("client is nil")
// HaltState returned if TestInvoke function processed without panic. // HaltState returned if TestInvoke function processed without panic.
const HaltState = "HALT" const HaltState = "HALT"
type NotHaltStateError struct { type notHaltStateError struct {
state, exception string state, exception string
} }
func (e *NotHaltStateError) Error() string { func (e *notHaltStateError) Error() string {
return fmt.Sprintf( return fmt.Sprintf(
"chain/client: contract execution finished with state %s; exception: %s", "chain/client: contract execution finished with state %s; exception: %s",
e.state, e.state,
@ -101,7 +101,7 @@ func (c *Client) Invoke(contract util.Uint160, fee fixedn.Fixed8, method string,
} }
if resp.State != HaltState { if resp.State != HaltState {
return &NotHaltStateError{state: resp.State, exception: resp.FaultException} return &notHaltStateError{state: resp.State, exception: resp.FaultException}
} }
if len(resp.Script) == 0 { if len(resp.Script) == 0 {
@ -151,7 +151,7 @@ func (c *Client) TestInvoke(contract util.Uint160, method string, args ...interf
} }
if val.State != HaltState { if val.State != HaltState {
return nil, &NotHaltStateError{state: val.State, exception: val.FaultException} return nil, &notHaltStateError{state: val.State, exception: val.FaultException}
} }
return val.Stack, nil return val.Stack, nil

View file

@ -244,7 +244,7 @@ func (c *Client) notaryInvoke(committee bool, contract util.Uint160, method stri
// check invocation state // check invocation state
if test.State != HaltState { if test.State != HaltState {
return &NotHaltStateError{state: test.State, exception: test.FaultException} return &notHaltStateError{state: test.State, exception: test.FaultException}
} }
// if test invocation failed, then return error // if test invocation failed, then return error