im using a stock trading api that throws a exception if a error happens. Write now when i put in the wrong order id i get the following exception
Exception has occurred: APIError
order_id is missing
I have added a try and catch so the exception will not go off in the catch block I dont know how to find out how it happen so it simply displays a message saying "generic error" how could i have it say order_id is missing? code
def isClosed(id):
global errorMesg
try:
y=api.get_order(id)
if (y.status=="filled"):
return 1
return 0
except:
# how can the below line disply why the exception went off?
print("generic error")
return -1