mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-23 15:33:26 +08:00
CleanError's print() is now pretty_print()
This commit is contained in:
parent
0f4bb6e604
commit
c4f06f5f96
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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] + '"',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user