Documentation ¶
Index ¶
Constants ¶
const ( // ErrIllegalArgument Indicates a method parameter is invalid. ErrIllegalArgument = FirstActorErrorCode + iota // ErrNotFound Indicates a requested resource does not exist. ErrNotFound // ErrForbidden Indicates an action is disallowed. ErrForbidden // ErrInsufficientFunds Indicates a balance of funds is insufficient. ErrInsufficientFunds // ErrIllegalState Indicates an actor's internal state is invalid. ErrIllegalState // ErrSerialization Indicates de/serialization failure within actor code. ErrSerialization // ErrUnhandledMessage Indicates the actor cannot handle this message. ErrUnhandledMessage // ErrUnspecified Indicates the actor failed with an unspecified error. ErrUnspecified // ErrAssertionFailed Indicates the actor failed a user-level assertion ErrAssertionFailed // Common error codes stop here. If you define a common error code above // this value it will have conflicting interpretations FirstActorSpecificExitCode = ExitCode(32) )
const ( Ok = ExitCode(0) // Indicates that the actor identified as the sender of a message is not valid as a message sender: // - not present in the state tree // - not an account actor (for top-level messages) // - code CID is not found or invalid // (not found in the state tree, not an account, has no code). SysErrSenderInvalid = ExitCode(1) // Indicates that the sender of a message is not in a state to send the message: // - invocation out of sequence (mismatched CallSeqNum) // - insufficient funds to cover execution SysErrSenderStateInvalid = ExitCode(2) // Indicates failure to find a method in an actor. SysErrInvalidMethod = ExitCode(3) // Indicates the message receiver trapped (panicked SysErrIllegalInstruction = ExitCode(4) // Indicates that the receiver of a message is not valid (and cannot be implicitly created). SysErrInvalidReceiver = ExitCode(5) // Indicates that a message sender has insufficient balance for the value being sent. // Note that this is distinct from SysErrSenderStateInvalid when a top-level sender can't cover // value transfer + gas. This code is only expected to come from inter-actor sends. SysErrInsufficientFunds = ExitCode(6) // Indicates message execution (including subcalls) used more gas than the specified limit. SysErrOutOfGas = ExitCode(7) // Indicates message execution is forbidden for the caller by runtime caller validation. SysErrForbidden = ExitCode(8) // Indicates actor code performed a disallowed operation. Disallowed operations include: // - mutating state outside of a state acquisition block // - failing to invoke caller validation // - aborting with a reserved exit code (including success or a system error). SysErrorIllegalActor = ExitCode(9) // Indicates an invalid argument passed to a runtime method. SysErrorIllegalArgument = ExitCode(10) // Indicates the actor returned a block handle that doesn't exist SysErrMissingReturn = ExitCode(11) // Unused SysErrReserved3 = ExitCode(12) SysErrReserved4 = ExitCode(13) SysErrReserved5 = ExitCode(14) SysErrReserved6 = ExitCode(15) )
The system error codes are reserved for use by the runtime. No actor may use one explicitly. Correspondingly, no runtime invocation should abort with an exit code outside this list. We could move these definitions out of this package and into the runtime spec.
const FirstActorErrorCode = ExitCode(16)
The initial range of exit codes is reserved for system errors. Actors may define codes starting with this one.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExitCode ¶
type ExitCode int64
func Unwrap ¶
Unwrap extracts an exit code from an error, defaulting to the passed default exit code.
err := ErrIllegalState.WithContext("my description: %w", err) exitcode.Unwrap(exitcode.ErrIllegalState, err) == exitcode.ErrIllegalArgument
func (ExitCode) IsSendFailure ¶
Whether an exit code indicates a message send failure. A send failure means that the caller's CallSeqNum is not incremented and the caller has not paid gas fees for the message (because the caller doesn't exist or can't afford it). A receipt with send failure does not indicate that the message (or another one carrying the same CallSeqNum) could not apply in the future, against a different state.