try: x =float('kjsd')except MyException('custom error') as e:print(e)# raise MyException("cannot divide by zero")
---------------------------------------------------------------------------ValueError Traceback (most recent call last)
Input In [21], in <cell line: 1>() 1try:
----> 2 x =float('kjsd') 3except MyException('custom error') as e:
ValueError: could not convert string to float: 'kjsd'
During handling of the above exception, another exception occurred:
TypeError Traceback (most recent call last)
Input In [21], in <cell line: 1>() 1try:
2 x =float('kjsd')
----> 3except MyException('custom error') as e:
4print(e)
TypeError: catching classes that do not inherit from BaseException is not allowed