Xbasic
ERROR_GENERATE Function
Syntax
V ERROR_GENERATE(C user_error_text)
V ERROR_GENERATE(N system_error_code )
Arguments
- user_error_text
The text that appears when the error occurs. Character
- system_error_code
Optional. The error code to return. Numeric
Description
Generate a user defined error in Xbasic script or udf.
Discussion
Enables an error handling routine, specifying the label marking that routine's location within a script. ERROR_GENERATE() causes an error to occur and displays the Error description as the error text. Use the ERROR_GENERATE() function in a script when you want to generate an error message.
Example
The following global function takes an object pointer and sets the font of the object.
function SetDefaultFont as L (op as P) if (.not. is_object(op) ) then error_generate("SetDefaultFont: Bad Object Pointer") end if if ((upper(op.class() ) "FIELD") .AND. (upper(op.class() ) "TEXT") ) then error_generate("Cannot set font of " + op.class() + "type objects") end if op.font.name = "ARIAL" op.font.size = 10 SetDefaultFont = .T. end function
See Also