Test Test

Error Handling

Compared to traditional / classic 4GL languages (like Informix® 4GL), Querix 4GL allows the developer to have much greater control over event handling with the extended behaviour of the WHENEVER ERROR statement.:
 

  WHENEVER [ ANY | GLOBAL | MODULE ] <event_type> <event_action>


Where <event_type> can be any one of:

 

  • ERROR
  • WARNING
  • NOT FOUND

 

 

  • ARGUMENT ERROR 
  • RETURN ERROR 
  • UNDEFINED FUNCTION 
  • INTERRUPT 
  • QUIT 
  • TERMINATE 
  • HANGUP 
  • FATAL ERROR 
  • <identifier> 



And the <event action> can be any one of:

 

  • CONTINUE
  • STOP
  • CALL <function_name>

 

This model provides a slight fundamental difference to the Informix 4GL WHENEVER ERROR statment. Under Informix 4GL, the approximate scope of a WHENEVER
statement is MODULE, whereby Querix allows to specify the scope global or module.
detail at a later stage.

Two new forms of WHENEVER have been added to handle , 'Global event handling' &
'event handling for a module or library'. You can now use:

WHENEVER GLOBAL ERROR call my_global_handler

WHENEVER MODULE ERROR call my_module_handler


These two forms handlers to be set which are called when no handler is defined
locally, allowing a default error handling function to be specified at a single
point.

The WHENEVER MODULE form is similar to WHENEVER GLOBAL, but causes the specified
error handling behaviour to only be executed when the program is executing a
function in the current module or library.

The WHENEVER GLOBAL and WHENEVER MODULE statements must be executed and can go
into the program or module initilization functions.