]> jfr.im git - erebus.git/commitdiff
slight changes to _goterror
authorJohn Runyon <redacted>
Thu, 29 Jun 2023 21:13:38 +0000 (15:13 -0600)
committerJohn Runyon <redacted>
Thu, 29 Jun 2023 21:13:38 +0000 (15:13 -0600)
bot.py
erebus.py

diff --git a/bot.py b/bot.py
index 451786b6eff0cf8e2722989afc8d79fcdfc0da56..e7747d8800e54073ae9330356a4325f69488104e 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -145,15 +145,19 @@ class Bot(object):
                self._checknick()
        def _goterror(self, pieces):
                # TODO: better handling, just reconnect that single bot
-               self.parent.mustquit = Exception(' '.join(pieces))
+               error = ' '.join(pieces)
                try:
-                       self.quit("Error detected: %s" % ' '.join(pieces))
+                       raise Exception(error)
+               except Exception as e:
+                       self.parent.mustquit = e
+               try:
+                       self.quit("Error detected: %s" % (error))
                except: pass
                try:
                        curs = self.parent.query("UPDATE bots SET connected = 0")
                        curs.close()
                except: pass
-               sys.exit(2)
+               self.log('!', 'Bot exiting due to: %s' % (error))
        def _got001(self, pieces):
                # We wait until the end of MOTD instead to consider ourselves registered, but consider uptime as of 001
                self.connecttime = time.time()
index 4b33231725bdafa149c7bf4e034a12e9c542f24b..0377d92ded68ae4014a3546e917048ec4303bb2d 100644 (file)
--- a/erebus.py
+++ b/erebus.py
@@ -333,6 +333,7 @@ def loop():
                for line in main.fd(fileno).getdata():
                        main.fd(fileno).parse(line)
        if main.mustquit is not None:
+               main.log('*', '!', 'Core exiting due to: %s' % (main.mustquit))
                raise main.mustquit
 
 if __name__ == '__main__':