Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/isida/vi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordiSabler <dissy@ya.ru>2017-08-04 18:48:37 +0300
committerdiSabler <dissy@ya.ru>2017-08-04 18:48:37 +0300
commit342af137ac5cc4224b4ba0c90b6a92f84c0ba027 (patch)
treec208ad11628bb31537a51ce93428211320c85a33
parent22ccaba99d82e88ee9a7d86ce4f396c9f2c21f40 (diff)
add: catch exception while logging
-rw-r--r--kernel.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/kernel.py b/kernel.py
index d51e7ce..11b194a 100644
--- a/kernel.py
+++ b/kernel.py
@@ -456,7 +456,10 @@ def remove_sub_space(t):
# Send request
def send_raw(raw_in, method, dt, fl={}):
if LOGGER:
- logger_self(dt)
+ try:
+ logger_self(dt)
+ except:
+ pprint(json.dumps(dt, indent=2, separators=(',', ': ')), 'red')
request = requests.post(API_URL % method, data=dt, files = fl)
if not request.status_code == 200:
pprint('*** Error code on %s: %s' % (method, request.status_code), 'red')
@@ -577,7 +580,10 @@ def check_updates():
except:
CHAT_ID = 0
if LOGGER:
- logger(msg_in)
+ try:
+ logger(msg_in)
+ except:
+ pprint(json.dumps(msg_in, indent=2, separators=(',', ': ')), 'red')
if msg_in.has_key('edited_message'):
msg_in['message'] = msg_in['edited_message']
pprint('*** Edited message!', 'yellow')