log errors to errors.log again

This commit is contained in:
jacob1 2016-10-19 21:01:29 -04:00
parent c8a5f804da
commit ab8a05ac1b
3 changed files with 5 additions and 11 deletions

View File

@ -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.",
"acc_warning": "Changing accounts during game. Please do not change accounts while playing.",
"tempban_kick": "{nick}",
"error_log": "An error has occurred and has been logged.",
"_": " vim: set sw=4 expandtab:"
}

View File

@ -50,11 +50,11 @@ class handle_error:
cli = 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:
cli.msg(botconfig.CHANNEL, msg)
cli.msg(botconfig.CHANNEL, messages["error_log"])
errlog(traceback.format_exc())
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:
def __init__(self, *cmds, raw_nick=False, flag=None, owner_only=False,

View File

@ -482,15 +482,8 @@ def pastebin_tb(cli, msg, exc):
resp = urllib.request.urlopen(req)
data = json.loads(resp.read().decode("utf-8"))
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:
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.)")
else:
cli.msg(botconfig.DEV_CHANNEL, " ".join((msg, url)))