Closed henrywuhu closed 6 years ago
Currently a general Exception
is being raised, so you would have to catch that not a ValueError
.
try:
x = con.bdh('USBX@ Curncy', 'PX_BID', '20180509','20180509')
except Exception:
print("ERROR")
ERROR
I do agree that raising a more concise Error would be preferable though.
As of commit 240fd0fd747aa94fcba5ec80461b86748191ab98 you should now be able to use your code above to catch these types of errors, e.g.
try:
x = con.bdh('USBX@ Curncy', 'PX_BID', '20180509','20180509')
except ValueError:
print("ERROR")
ERROR
Hey.
I am doing a program to fetch data from bloomberg. I read a csv file that contains tickers. If a ticker is invalid, how can i do the error handling.
For example USBX@ is not a valid security my code is the following:
for example if I run it on Pycharm I get the following string of exceptions. In this I can check that there is an invalid security, but how can I get the subcategory error immediately from try except using ValueError or NameError