utils.py 412 B

123456789101112131415161718
  1. import traceback
  2. def provide_sender(func, sender):
  3. def inner_function(*args, **kwargs):
  4. try:
  5. func()
  6. except TypeError:
  7. func(sender)
  8. return inner_function
  9. def handle_exceptions(func):
  10. def inner_function(*args, **kwargs):
  11. try:
  12. func(*args, **kwargs)
  13. except Exception as e:
  14. traceback.print_exc()
  15. return inner_function