613-518-1166 info@zimdatabases.com

ZIM Language Reference

SET EXCEPTION

< All Topics

Triggers an exception handler in the absence of an exception condition.

Syntax

SET EXCEPTION condition

Parameters

condition Can be BREAK Mimics a terminal or process “break” condition (i.e., the user pressing the “break” key). DEADLOCK Mimics a deadlock in a multi-user system. Does not abort the current transaction. ERROR Mimics an error condition. WARNING Mimics a warning condition.

Comments

A SET EXCEPTION command mimics the specified condition, triggering the associated exception handler, if such a handler has been declared (by the ON command). The SET EXCEPTION command cannot be used in the body of an exception handler. The SET EXCEPTION command has no effect on system variables such as $InTransaction, $ErrCode, or $ErrLevel. The SET EXCEPTION command is not affected by the SET RESET and SET RESTORE commands.

Example

localprocedure LocProc (inout $Deadlock)

on deadlock

let $Deadlock = $true

return

endon

… other commands …

endprocedure

procedure MainProc ()

on deadlock

goto RetryTransaction

endon

… other commands …

RetryTransaction:

transaction

… other commands …

LocProc ($Deadlock)

if $Deadlock = $true

set exception deadlock

endif

… other commands …

endtransaction

endprocedure

In the preceding example, SET EXCEPTION mimics a DEADLOCK condition, triggering the declared deadlock exception handler in one procedure when the deadlock has actually occurred in another procedure.  

Was this article helpful?
0 out Of 5 Stars
5 Stars 0%
4 Stars 0%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?

Submit a Comment

Your email address will not be published. Required fields are marked *

Table of Contents