ERROR [ ( errormessage | errorcode ) ] ;
ERROR ( errorcode , errormessage ) ;
ERROR( datatype [, [ errorcode ] [, errormessage ] ] ) ;
errormessage | Optional. A string constant containing the message to display. |
errorcode | Optional. An integer constant containing the error number to display. |
datatype | The 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;