I'm trying to create an exception that contains the typical string and an additional piece of data:
class MyException(RuntimeError):
def __init__(self,numb):
self.numb = numb
try:
raise MyException("My bad", 3)
except MyException as me:
print(me)
When I run the above I get the obvious complaint that I've got only two arguments in __init__ but I passed three. I don't know how to get the typical string into my exception and add data.