@Error (JavaScript)
Assigns an error condition to a value.
Defined in
@Functions (JavaScript)Syntax
@Error() : Object
Return value | Description |
---|---|
Object |
An undefined value. This value is only useful as a parameter to @IsError (JavaScript). |
Usage
Do not save@Error()
as
an element value.Examples
This example contains a function that returns@Error()
in certain cases. The top-level
function tests for @Error()
.function getfield(fieldname) {
var n = @GetField(fieldname);
@Return(@If(n < 0, @Error(), n > 255, @Error(), n));
}
@If(@IsError(getfield("//field3")),
"Out of range",
// else
getfield("//field3"));