Reraise Statement

Action

Raises an exception again and passes control to the next exception handler.

Syntax

reraise

Notes

  • Use reraise to raise an exception again, after an exception handler has trapped the original exception, but you want control to pass to the next exception handler, if any.

  • reraise passes control to the next exception handler in the current block, or in any block in which the function that caused the exception is called. If no other exception handler is found, the script halts.

Example

[ ] // This script is stored in a file called reraise.t
[-] testcase reraiseExample ()
	[ ] LIST OF INTEGER liXcept
	[-] do 
		[ ] BuildList (liXcept)
	[-] except
		[ ] Print (liXcept)
	[ ] reraise
	[ ] 
[-] BuildList (out LIST OF INTEGER liXcept)
	[-] const LIST OF INTEGER liNum = {...}
		[ ] 20
		[ ] 10 
		[ ] 0
		[ ] 5 
	[ ] INTEGER i 
	[ ] liXcept = {}
	[-] for each i in liNum
		[ ] ListAppend (liXcept, 100 / i)
	[ ] // This script prints:
	[ ] // Testcase reraiseExample - 1 error
	[ ] // { 5, 10 }
	[ ] // *** Error: Divide by zero
	[ ] // Occurred in BuildList at reraise.t(18)
	[ ] // Called from reraiseExample at reraise.t(5)