MariaS's blog
Exception handling front arena
Submitted by MariaS on Thu, 01/22/2009 - 07:12you can use the python exception mechanism to handle exceptions. A couple of simple examples describing this process are as follows.
import acm
msg = 'Zero or one stocks expected'
try:
stock = acm.FStock.Select01("contractSize=1",msg)
except RuntimeError , e:
print e
As mand stocks could have a contract size of one, the value of e is the value of msg passed to the select01() method.
import acm
a= acm.FArray()
a[0] = "FRED"
try:
print a.IntAt(0)
except TypeError , e:
print e