Skip to main content

The errors Contract

The errors contract is one of the core contracts on each IOTA Smart Contracts chain.

The errors contract keeps a map of error codes to error message templates. This allows contracts to store lengthy error strings only once and then reuse them by just providing the error code (and optional extra values) when producing an error, thus saving storage and gas.

Entry Points​

registerError​

Registers an error message template.

Parameters​

NameTypeOptionalDescription
errorMessageFormatstringNoThe error message template, which supports standard go verbs for variable printing

Returns​

NameTypeDescription
vmErrorCodeVMErrorCodeThe error code of the registered template

Views​

getErrorMessageFormat​

Returns the message template stored for a given error code.

Parameters​

NameTypeOptionalDescription
vmErrorCodeVMErrorCodeNoThe error code of the registered template

Returns​

NameTypeDescription
errorMessageFormatstringThe error message template