throw/list
Throw an exception with exception information provided as a Uniface list.
throw/list ExceptionInfo
Example: throw/list uerror::getInParamSyntaxError("pNameOfInParam", pNameOfInParam, "Not a number")
Parameters
Parameter | Data Type | Description |
---|---|---|
ExceptionInfo | String | An associative list with items ERROR , DESCRIPTION and ADDITIONAL .
|
Return Values
After the throw statement, $procerror has the value that was specified in the ERROR
item in the ExceptionInfo argument, and $procerrorcontext has items with IDs DESCRIPTION
and ADDITIONAL
, which have the same values as their respective counterparts in the ExceptionInfo argument of the throw/list statement.
If ExceptionInfo does not have:
- An
ERROR
item, $procerrorcontext will have anERROR
item with value-1
, or<UGENERR_ERROR>
. - A
DESCRIPTION
item, $procerrorcontext will have aDESCRIPTION
item with valueCustom exception
. - An
ADDITIONAL
item, $procerrorcontext will not have theADDITIONAL
item either.
Use
Allowed in all component types.
Description
Like the throw statement, the throw/list statement stops execution of the current block of code.
The throw/list statement enables you to use ProcScript modules that prepare a coherent set of exception-related information for use with the throw statement. For example:
throw/list prepare_exception(...)
where prepare_exception
is an entry that prepares a Uniface list with the three exception-related items.
If the throw/list statement is:
- Inside a try...catch...endtry block, code execution continues in one of the associated catch blocks, if there is an applicable one. If not, the exception bubbles up to the next try-level or to the caller of the module.
- Outside a try...catch...endtry block but in a ProcScript module that has the
throws
clause, code execution continues within the calling module, with the statement following the call to this module. - Outside a try...catch...endtry block, in a ProcScript module that does not have the
throws
clause, the ProcScript compiler returns as error:error: 1000 - "throw" statement only allowed inside a try block or in a module declared as throws