import typing
class A:
def __init__(self, symbol: str):
if not symbol:
raise self.MissingException('Symbol (str) required!')
self.symbol = symbol
class MissingException(Exception):
pass
if __name__ == '__main__':
A(None)
Output
Traceback (most recent call last):
File "/tmp/test.py", line 16, in <module>
A(None)
File "/tmp/test.py", line 7, in __init__
raise self.MissingException('Symbol (str) required!')
__main__.MissingException: Symbol (str) required!
Could someone please help me understand why is the Exception named __main__.MissingException
instead of being named as __main__.A.MissingException
?
Thanks