I am trying to learn Python and I want to know if it is possible to pass a variable to an Exception? This is the code I have:
try:
    staffId = int(row['staffId'])
    openingSalary = int(row['initialSalary'])
    monthsWorked = float(row['monthsWorked'])
except CutomException:
    pass
class CustomException(ValueError): # raised if data conversion fails
    def __init__(self):
        print("There was a problem converting data")
I want to pass staffId to the exception so that I can print something like: 
print("There was a problem converting data for staff Id: ", staffId)
I tried this with no success: How to pass a variable to an exception when raised and retrieve it when excepted?
 
     
     
     
    