SerializeParams should return ErrSerialization
This commit is contained in:
parent
5c791cd93b
commit
2219bff1c9
@ -3,6 +3,8 @@ package actors
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/exitcode"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
)
|
)
|
||||||
@ -11,7 +13,7 @@ func SerializeParams(i cbg.CBORMarshaler) ([]byte, aerrors.ActorError) {
|
|||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
if err := i.MarshalCBOR(buf); err != nil {
|
if err := i.MarshalCBOR(buf); err != nil {
|
||||||
// TODO: shouldnt this be a fatal error?
|
// TODO: shouldnt this be a fatal error?
|
||||||
return nil, aerrors.Absorb(err, 1, "failed to encode parameter")
|
return nil, aerrors.Absorb(err, exitcode.ErrSerialization, "failed to encode parameter")
|
||||||
}
|
}
|
||||||
return buf.Bytes(), nil
|
return buf.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user