summaryrefslogtreecommitdiff
path: root/foreign/parse/error_exception_handling.py
blob: 27080a9054db354f8b1100879e4b358a8b37b87b (plain)
1
2
3
4
5
6
7
8
9
10
11
from binary.data_handling.send_data import *
from foreign.global_state import *


def error_exception_handling(func):
  def func_wrapper(conn, data):
    try:
      func(conn, data)
    except Exception as err:
      send_data(conn, {'message': f'Error: {err}\nPlease validate your input & try again', 'text_mode': 'danger'}, (state['settings']['encryption'], state['settings']['encoding'], state['settings']['headersize']))
  return func_wrapper