log errors to errors.log again
This commit is contained in:
parent
c8a5f804da
commit
ab8a05ac1b
@ -862,6 +862,7 @@
|
|||||||
"quit_warning": "Quitting IRC during game. You only have a short time to re-join the channel after quitting to stay alive.",
|
"quit_warning": "Quitting IRC during game. You only have a short time to re-join the channel after quitting to stay alive.",
|
||||||
"acc_warning": "Changing accounts during game. Please do not change accounts while playing.",
|
"acc_warning": "Changing accounts during game. Please do not change accounts while playing.",
|
||||||
"tempban_kick": "{nick}",
|
"tempban_kick": "{nick}",
|
||||||
|
"error_log": "An error has occurred and has been logged.",
|
||||||
|
|
||||||
"_": " vim: set sw=4 expandtab:"
|
"_": " vim: set sw=4 expandtab:"
|
||||||
}
|
}
|
||||||
|
@ -50,11 +50,11 @@ class handle_error:
|
|||||||
cli = None
|
cli = None
|
||||||
|
|
||||||
if cli is not None:
|
if cli is not None:
|
||||||
msg = "An error has occurred and has been logged."
|
|
||||||
if not botconfig.PASTEBIN_ERRORS or botconfig.CHANNEL != botconfig.DEV_CHANNEL:
|
if not botconfig.PASTEBIN_ERRORS or botconfig.CHANNEL != botconfig.DEV_CHANNEL:
|
||||||
cli.msg(botconfig.CHANNEL, msg)
|
cli.msg(botconfig.CHANNEL, messages["error_log"])
|
||||||
|
errlog(traceback.format_exc())
|
||||||
if botconfig.PASTEBIN_ERRORS and botconfig.DEV_CHANNEL:
|
if botconfig.PASTEBIN_ERRORS and botconfig.DEV_CHANNEL:
|
||||||
pastebin_tb(cli, msg, traceback.format_exc())
|
pastebin_tb(cli, messages["error_log"], traceback.format_exc())
|
||||||
|
|
||||||
class cmd:
|
class cmd:
|
||||||
def __init__(self, *cmds, raw_nick=False, flag=None, owner_only=False,
|
def __init__(self, *cmds, raw_nick=False, flag=None, owner_only=False,
|
||||||
|
@ -482,15 +482,8 @@ def pastebin_tb(cli, msg, exc):
|
|||||||
resp = urllib.request.urlopen(req)
|
resp = urllib.request.urlopen(req)
|
||||||
data = json.loads(resp.read().decode("utf-8"))
|
data = json.loads(resp.read().decode("utf-8"))
|
||||||
url = data["url"] + "/py3tb"
|
url = data["url"] + "/py3tb"
|
||||||
except urllib.error.HTTPError as e:
|
|
||||||
if e.code == 409: # paste ID conflict
|
|
||||||
pastebin_tb(exc) # retry
|
|
||||||
else:
|
|
||||||
# Make sure we print the exception anyway
|
|
||||||
traceback.print_exc()
|
|
||||||
cli.msg(botconfig.DEV_CHANNEL, msg + " (Unable to pastebin traceback; please check the console.)")
|
|
||||||
except Exception:
|
except Exception:
|
||||||
traceback.print_exc()
|
# Exception is already printed before calling this function, don't print twice
|
||||||
cli.msg(botconfig.DEV_CHANNEL, msg + " (Unable to pastebin traceback; please check the console.)")
|
cli.msg(botconfig.DEV_CHANNEL, msg + " (Unable to pastebin traceback; please check the console.)")
|
||||||
else:
|
else:
|
||||||
cli.msg(botconfig.DEV_CHANNEL, " ".join((msg, url)))
|
cli.msg(botconfig.DEV_CHANNEL, " ".join((msg, url)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user