ERROR

ERROR [ ( errormessage | errorcode ) ] ;

ERROR ( errorcode , errormessage ) ;

ERROR( datatype [, [ errorcode ] [, errormessage ] ] ) ;

errormessageOptional. A string constant containing the message to display.
errorcodeOptional. An integer constant containing the error number to display.
datatypeThe value type or name of a RECORD structure. This may use the TYPEOF function.

The ERROR function immediately halts processing on the workunit and displays the errorcode and/or errormessage. The third form is available for use in contexts where a value type or dataset is required. This function does the same thing as the FAIL action, but may be used in an expression context, such as within a TRANSFORM function.

Example:

outrec Xform(inrec L, inrec R) := TRANSFORM
  SELF.key := IF(L.key <= R.key, R.key,ERROR('Recs not in order'));
END;

See Also: FAILURE, FAIL