From 9d16f7d5237b3b7a55e01b375747e40d7c1ced43 Mon Sep 17 00:00:00 2001 From: jesopo Date: Tue, 10 Dec 2019 05:26:16 +0000 Subject: move sys.exit() codes to an enum in utils.consts --- src/IRCBot.py | 2 +- src/utils/consts.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/IRCBot.py b/src/IRCBot.py index 40728096..89779f98 100644 --- a/src/IRCBot.py +++ b/src/IRCBot.py @@ -144,7 +144,7 @@ class Bot(object): exc_info = True self.log.critical("panic() called: %s", [reason], exc_info=exc_info) - sys.exit(20) + sys.exit(utils.consts.Exit.PANIC) def _module_lists(self): whitelist = self.config.get_list("module-whitelist") diff --git a/src/utils/consts.py b/src/utils/consts.py index d53a4660..423c7eac 100644 --- a/src/utils/consts.py +++ b/src/utils/consts.py @@ -1,4 +1,4 @@ -import typing +import enum, typing from . import _consts_256_color class IRCColor(object): @@ -68,3 +68,11 @@ ANSI_UNDERLINE_RESET = "\033[24m" PERMISSION_HARD_FAIL = 0 PERMISSION_FORCE_SUCCESS = 1 PERMISSION_ERROR = 2 + +class Exit(enum.Enum): + WRONGVERSION = 1 + LOCKED = 2 + DISCONNECT = 3 + FATAL = 4 + + PANIC = 20 -- cgit v1.3.1-10-gc9f91