Newsletter: February 2006
Quick Tip - Trapping a Python Scripting Error
When errors occur within scripts in Iguana, it usually stops a channel and then things back up, which can sometimes annoy users and cause grief. This can happen when something new and unexpected is discovered in the data for an HL7 message.
There is a method to trap errors within your Python script.
error_flag = 0
from RTFtoTXT import getTxtFromRtf
try:
plainText = getTxtFromRtf(ObservationValue)
except:
plainText = ""
error_flag = 1
In the above a function is called, and if it works error_flag remains 0, but if it fails then error_flag would be set to 1, and could be tested allowing for whatever alternate action is needed.

