I have a list like this
errlist = ["ERR1", "ERR2"]
I want to create Exception Classes based on the list.
This is what i did in errors.py
for e in errlist:
type(e, (Exception,) {})
My intention is so that I can do this:-
from errors import *
try:
raise ERR1("testing")
except ERR1 as e:
do something
How could i achieve that? The method i was doing does not seem to work.
Thanks in advance.