This example shows how to catch custom Exception
class CustomError(Exception):
     pass
try:
    raise CustomError('Can you catch me ?')
except CustomError as e:
    print ('Catched CustomError :{}'.format(e))
except Exception as e:
    print ('Generic exception: {}'.format(e))
Output:
Catched CustomError :Can you catch me ?
 
                