What is better?
class CustomException(Exception):
pass
class CustomSomething(object):
def do_something(self, xml):
try:
lxml.etree.parse(xml)
except LxmlError as e: # LxmlError class is only example
raise CustomException(e)
or just
class CustomSomething(object):
def do_something(self, xml):
lxml.etree.parse(xml)
When should I use a try/except block and raise custom exceptions, and when should I let whatever's calling my function handle it?