diff --git a/kattcmd/commands/root.py b/kattcmd/commands/root.py index 7e60f6a32370eda80daab21860ca15a26f83108b..db62a837dfb1185fa3f93e82a13586ba6d4498df 100644 --- a/kattcmd/commands/root.py +++ b/kattcmd/commands/root.py @@ -4,7 +4,9 @@ import configparser class FindRootException(Exception): - pass + + def __init__(self, message): + self.message = message def _IsKattisDirectory(path): diff --git a/kattcmd/commands/submit.py b/kattcmd/commands/submit.py index 1970522123ca54b02c46005aaba740649e613c79..c34b2c4ddbba68c2be6ccd5f20a7f909180b2c77 100644 --- a/kattcmd/commands/submit.py +++ b/kattcmd/commands/submit.py @@ -10,7 +10,9 @@ HEADERS = { } class LoginError(Exception): - pass + + def __init__(self, message): + self.message = message def _GetFilesWithExtensions(bus, problemname, exts): @@ -28,7 +30,7 @@ def _GetFilesWithExtensions(bus, problemname, exts): def _GetUserConfig(bus): configfile = bus.call('kattcmd:config:load-user', bus, 'kattisrc') if not configfile or not os.path.isfile(configfile): - raise LoginError('No .kattisrc file present') + raise LoginError('No .kattisrc file present. Make sure to download it') config = configparser.ConfigParser() config.read(configfile) return config diff --git a/kattcmd/main.py b/kattcmd/main.py index 45ff55d3c05480029f4c1f22e16ec0b3229b48f3..ce73a70fcafed9cb528ec63ed6307e513062fc4b 100644 --- a/kattcmd/main.py +++ b/kattcmd/main.py @@ -50,4 +50,11 @@ def main(): if __name__ == '__main__': - main() + try: + main() + except Exception as e: + print(dir(e)) + if hasattr(e, 'message'): + print(e.message) + else: + print(e)