all repos — listfix @ 80140a14ba732d5196dab4cd988b862f8cad3980

Postfix Mailing List Software; Maintained on behalf the of Agency Economy Incorporated NFP.

switch out false return values with exceptions.

	modified:   listfix/args.py
Brian Barto bartobrian@gmail.com
Tue, 29 Mar 2022 20:57:56 -0400
commit

80140a14ba732d5196dab4cd988b862f8cad3980

parent

798bc41ae5e67c136e8983a80d933f83aefd68a8

1 files changed, 8 insertions(+), 8 deletions(-)

jump to
M listfix/args.pylistfix/args.py

@@ -13,40 +13,40 @@ if (len(args) >= 2):

self.args = args self.command = args[1] else: - return False + raise IndexError("Missing command argument.") else: - return False + raise TypeError("Arguments should be of list type.") def get_command(self): return self.command def get_list_email(self): if (len(self.args) < 3): - return False + raise IndexError(f"Missing argument(s) for '{self.command}' command.") if (not re_email_arg.match(self.args[2])): - return False + raise ValueError(f"Invalid argument value: {self.args[2]}") return self.args[2] def get_list_name(self): if (len(self.args) < 4): - return False + raise IndexError(f"Missing argument(s) for '{self.command}' command.") return self.args[3] def get_recipient_email(self): if (len(self.args) < 4): - return False + raise IndexError(f"Missing argument(s) for '{self.command}' command.") if (not re_email_arg.match(self.args[3])): - return False + raise ValueError(f"Invalid argument value: {self.args[3]}") return self.args[3] def get_recipient_name(self): if (len(self.args) < 5): - return False + raise IndexError(f"Missing argument(s) for '{self.command}' command.") return self.args[4]