What the best way of handling exceptions.
class SRException(Exception):
default_exception = True
def somefun1(email):
try:
user = somefun2(email)
except Exception, e:
raise SRException, ("could not find the email", e)
def somefun2(email):
try:
user = User.objects.get(email = email)
except Exception, e:
raise SRException, ("could not find the user objecets",e )
So when exception happens I get a long list of Exception
UserProfileException('could not find the user or service objects', UserProfileException('could not find the user', ServicesException('could not find the service', DoesNotExist('Services matching query does not exist.',))))))))
Error and above code examples are not the same. But I guess I made my point clear.
So what the best way of handling exceptions. Should I not raise it in every exceptions. And I am sending mail to technical team every time exceptions occurs.