error info

Description

The error info clause is used to customize the error produced in case a condition is not fulfilled.

If the optional error info clause is not specified then Obix creates a default error message. However, the default error message might not contain enough debugging information, or information that helps the user to correct the error. For example, if an input argument name must contain at least 3 characters, the default error message is something like "Invalid value for input argument 'name'", while a customized error message could be: "'name' contains only 2 characters, bust must contain 3 at least.".

Hence, explicitly specifying appropriate error info clauses in the source code is especially important whenever an application goes into production.

Syntax

Table 8.27. error info syntax

ProductionSyntaxLinks
error_info ( "error_message" ":" expression ) ? ( "error_id" ":" identifier ) ? ( "error_data" ":" expression ) ? the section called “error info

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

  • identifier can be any valid identifier (e.g. price_too_high), 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.

Example

see Example 8.25, “check script example”

See also