mirror of
https://github.com/hyper-neptune/yuuki.git
synced 2024-11-15 10:54:45 +08:00
Add ErrorInfo
This commit is contained in:
parent
d4cf7eb4f2
commit
bd61d2cc41
1 changed files with 12 additions and 6 deletions
|
@ -1,9 +1,11 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# coding=UTF-8
|
# coding=UTF-8
|
||||||
|
|
||||||
import os, time,\
|
import os, time, \
|
||||||
requests, \
|
requests, \
|
||||||
json, ntpath
|
json, ntpath,\
|
||||||
|
traceback
|
||||||
|
|
||||||
|
|
||||||
from libs.core.TalkService import *
|
from libs.core.TalkService import *
|
||||||
from .connection import Yuuki_Connect
|
from .connection import Yuuki_Connect
|
||||||
|
@ -170,6 +172,10 @@ class Yuuki:
|
||||||
pass
|
pass
|
||||||
except:
|
except:
|
||||||
err1, err2, err3 = sys.exc_info()
|
err1, err2, err3 = sys.exc_info()
|
||||||
|
traceback.print_tb(err3)
|
||||||
|
tb_info = traceback.extract_tb(err3)
|
||||||
|
filename, line, func, text = tb_info[-1]
|
||||||
|
ErrorInfo = "occurred {} on line {} in statement {}".format(filename, line, text)
|
||||||
try:
|
try:
|
||||||
if catchedNews and ncMessage:
|
if catchedNews and ncMessage:
|
||||||
Finded = False
|
Finded = False
|
||||||
|
@ -182,8 +188,8 @@ class Yuuki:
|
||||||
if not Finded:
|
if not Finded:
|
||||||
Revision = self.client.getLastOpRevision()
|
Revision = self.client.getLastOpRevision()
|
||||||
for Root in self.Admin:
|
for Root in self.Admin:
|
||||||
self.sendText(Root, "Star Yuuki BOT - Something was wrong...\nError:\n%s\n%s\n%s" %
|
self.sendText(Root, "Star Yuuki BOT - Something was wrong...\nError:\n%s\n%s\n%s\n%s" %
|
||||||
(err1, err2, err3))
|
(err1, err2, err3, ErrorInfo))
|
||||||
except:
|
except:
|
||||||
print("Star Yuuki BOT - Damage!\nError:\n%s\n%s\n%s" % (err1, err2, err3))
|
print("Star Yuuki BOT - Damage!\nError:\n%s\n%s\n%s" % (err1, err2, err3))
|
||||||
self.exit()
|
self.exit()
|
||||||
|
@ -218,4 +224,4 @@ class Yuuki:
|
||||||
Time1 = time.time()
|
Time1 = time.time()
|
||||||
self.sendText(self.sendToWho(ncMessage), _("Testing..."))
|
self.sendText(self.sendToWho(ncMessage), _("Testing..."))
|
||||||
Time2 = time.time()
|
Time2 = time.time()
|
||||||
self.sendText(self.sendToWho(ncMessage), _("Speed:\n%ss") % (Time2 - Time1,))
|
self.sendText(self.sendToWho(ncMessage), _("Speed:\n{}s").format(Time2 - Time1,))
|
||||||
|
|
Loading…
Reference in a new issue