CleanError's print() is now pretty_print()

This commit is contained in:
Eric Froemling 2020-05-03 14:59:17 -07:00
parent 0f4bb6e604
commit c4f06f5f96
4 changed files with 6 additions and 6 deletions

View File

@ -365,5 +365,5 @@ if __name__ == '__main__':
ServerManagerApp().run_interactive()
except CleanError as clean_exc:
# For clean errors, do a simple print and fail; no tracebacks/etc.
clean_exc.print()
clean_exc.pretty_print()
sys.exit(1)

View File

@ -440,5 +440,5 @@ if __name__ == '__main__':
# Can make this optional if a backtrace is ever useful..
sys.exit(-1)
except CleanError as exc:
exc.print()
exc.pretty_print()
sys.exit(-1)

View File

@ -42,10 +42,10 @@ class CleanError(Exception):
more descriptive exception types.
"""
def print(self, flush: bool = False) -> None:
"""Print the error to stdout, using colored output if available.
def pretty_print(self, flush: bool = False) -> None:
"""Print the error to stdout, using red colored output if available.
If the error has no message, nothing will be printed.
If the error has an empty message, prints nothing (not even a newline).
"""
from efro.terminal import Clr
errstr = str(self)

View File

@ -72,7 +72,7 @@ def snippets_main(globs: Dict[str, Any]) -> None:
try:
funcs[sys.argv[1]]()
except CleanError as exc:
exc.print()
exc.pretty_print()
sys.exit(-1)
else:
print('Unknown snippets command: "' + sys.argv[1] + '"',