[#1689] morph: Remove frostfsError
type
It has no custom methods defined, only adds `frostfs error: ` prefix to the error message. The utility of this prefix is debatable, failed invocations already have `invocation failed` prefix. Change-Id: If25ebb3679497f3f10acde43b596c81d52351907 Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
52367dc9b2
commit
3d771aa21c
4 changed files with 7 additions and 23 deletions
|
@ -151,20 +151,6 @@ func (e *notHaltStateError) Error() string {
|
|||
)
|
||||
}
|
||||
|
||||
// implementation of error interface for FrostFS-specific errors.
|
||||
type frostfsError struct {
|
||||
err error
|
||||
}
|
||||
|
||||
func (e frostfsError) Error() string {
|
||||
return fmt.Sprintf("frostfs error: %v", e.err)
|
||||
}
|
||||
|
||||
// wraps FrostFS-specific error into frostfsError. Arg must not be nil.
|
||||
func wrapFrostFSError(err error) error {
|
||||
return frostfsError{err}
|
||||
}
|
||||
|
||||
// Invoke invokes contract method by sending transaction into blockchain.
|
||||
// Returns valid until block value.
|
||||
// Supported args types: int64, string, util.Uint160, []byte and bool.
|
||||
|
@ -228,7 +214,7 @@ func (c *Client) TestInvokeIterator(cb func(stackitem.Item) error, batchSize int
|
|||
if err != nil {
|
||||
return err
|
||||
} else if val.State != HaltState {
|
||||
return wrapFrostFSError(¬HaltStateError{state: val.State, exception: val.FaultException})
|
||||
return ¬HaltStateError{state: val.State, exception: val.FaultException}
|
||||
}
|
||||
|
||||
arr, sid, r, err := unwrap.ArrayAndSessionIterator(val, err)
|
||||
|
@ -292,7 +278,7 @@ func (c *Client) TestInvoke(contract util.Uint160, method string, args ...any) (
|
|||
}
|
||||
|
||||
if val.State != HaltState {
|
||||
return nil, wrapFrostFSError(¬HaltStateError{state: val.State, exception: val.FaultException})
|
||||
return nil, ¬HaltStateError{state: val.State, exception: val.FaultException}
|
||||
}
|
||||
|
||||
success = true
|
||||
|
|
|
@ -461,7 +461,7 @@ func (c *Client) notaryInvoke(ctx context.Context, committee, invokedByAlpha boo
|
|||
|
||||
mainH, fbH, untilActual, err := nAct.Notarize(nAct.MakeTunedCall(contract, method, nil, func(r *result.Invoke, t *transaction.Transaction) error {
|
||||
if r.State != vmstate.Halt.String() {
|
||||
return wrapFrostFSError(¬HaltStateError{state: r.State, exception: r.FaultException})
|
||||
return ¬HaltStateError{state: r.State, exception: r.FaultException}
|
||||
}
|
||||
|
||||
t.ValidUntilBlock = until
|
||||
|
@ -608,8 +608,7 @@ func (c *Client) notaryMultisigAccount(ir []*keys.PublicKey, committee, invokedB
|
|||
multisigAccount = wallet.NewAccountFromPrivateKey(c.acc.PrivateKey())
|
||||
err := multisigAccount.ConvertMultisig(m, ir)
|
||||
if err != nil {
|
||||
// wrap error as FrostFS-specific since the call is not related to any client
|
||||
return nil, wrapFrostFSError(fmt.Errorf("convert account to inner ring multisig wallet: %w", err))
|
||||
return nil, fmt.Errorf("convert account to inner ring multisig wallet: %w", err)
|
||||
}
|
||||
} else {
|
||||
// alphabet multisig redeem script is
|
||||
|
@ -617,8 +616,7 @@ func (c *Client) notaryMultisigAccount(ir []*keys.PublicKey, committee, invokedB
|
|||
// inner ring multiaddress witness
|
||||
multisigAccount, err = notary.FakeMultisigAccount(m, ir)
|
||||
if err != nil {
|
||||
// wrap error as FrostFS-specific since the call is not related to any client
|
||||
return nil, wrapFrostFSError(fmt.Errorf("make inner ring multisig wallet: %w", err))
|
||||
return nil, fmt.Errorf("make inner ring multisig wallet: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ func StringFromStackItem(param stackitem.Item) (string, error) {
|
|||
func addFeeCheckerModifier(add int64) func(r *result.Invoke, t *transaction.Transaction) error {
|
||||
return func(r *result.Invoke, t *transaction.Transaction) error {
|
||||
if r.State != HaltState {
|
||||
return wrapFrostFSError(¬HaltStateError{state: r.State, exception: r.FaultException})
|
||||
return ¬HaltStateError{state: r.State, exception: r.FaultException}
|
||||
}
|
||||
|
||||
t.SystemFee += add
|
||||
|
|
|
@ -47,5 +47,5 @@ func (c *Client) WaitTxHalt(ctx context.Context, vub uint32, h util.Uint256) err
|
|||
if res.VMState.HasFlag(vmstate.Halt) {
|
||||
return nil
|
||||
}
|
||||
return wrapFrostFSError(¬HaltStateError{state: res.VMState.String(), exception: res.FaultException})
|
||||
return ¬HaltStateError{state: res.VMState.String(), exception: res.FaultException}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue