error instruction

Description

The error instruction is used to programmatically raise an error. The current script execution stops immediately.

[Note]Note
The error instruction in Obix is similar to the throw statement in Java, C#, and other programming languages.

Syntax

Table 8.25. error syntax

ProductionSyntaxLinks
error_instruction "error" expression ( "id" ":" identifier ) ? ( "data" ":" expression ) ? the section called “error instruction”

  • the first expression must be of type string and specifies the error message.

  • identifier can be any valid identifier (e.g. index_out_of_bounds), used for example to classify errors for statistical purposes.

  • the second expression is of type any_type and is used to describe the error in a structured way, for example to inspect it programmatically at runtime.

Examples

See also