Move error messages into docstrings

This commit is contained in:
Dan 2017-12-30 19:25:17 +01:00
parent 8be5351452
commit 5c3487dc8a
3 changed files with 8 additions and 4 deletions

View File

@ -108,12 +108,12 @@ def start():
notice=notice, notice=notice,
super_class=super_class, super_class=super_class,
code=code, code=code,
name="\"{}\"".format(name), docstring='"""{}"""'.format(name),
sub_classes="".join([sub_class_template.format( sub_classes="".join([sub_class_template.format(
sub_class=k[0], sub_class=k[0],
super_class=super_class, super_class=super_class,
id="\"{}\"".format(k[1]), id="\"{}\"".format(k[1]),
message="\"{}\"".format(k[2]) docstring='"""{}"""'.format(k[2])
) for k in sub_classes]) ) for k in sub_classes])
) )

View File

@ -4,8 +4,10 @@ from ..error import Error
class {super_class}(Error): class {super_class}(Error):
{docstring}
CODE = {code} CODE = {code}
NAME = {name} """:obj:`int`: Error Code"""
NAME = __doc__
{sub_classes} {sub_classes}

View File

@ -1,5 +1,7 @@
class {sub_class}({super_class}): class {sub_class}({super_class}):
{docstring}
ID = {id} ID = {id}
MESSAGE = {message} """:obj:`str`: Error ID"""
MESSAGE = __doc__