mirror of
https://github.com/caelestia-dots/cli.git
synced 2026-06-16 05:49:59 -05:00
fix: allow logging exceptions + Never fatal return
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import sys
|
import sys
|
||||||
|
from typing import Never
|
||||||
|
|
||||||
|
|
||||||
def log_exception(func):
|
def log_exception(func):
|
||||||
@@ -33,12 +34,12 @@ def warn(msg: str) -> None:
|
|||||||
print(_format_msg(33, f"Warning: {msg}"))
|
print(_format_msg(33, f"Warning: {msg}"))
|
||||||
|
|
||||||
|
|
||||||
def error(msg: str) -> None:
|
def error(err: str | Exception) -> None:
|
||||||
print(_format_msg(31, f"Error: {msg}"), file=sys.stderr)
|
print(_format_msg(31, f"Error: {err}"), file=sys.stderr)
|
||||||
|
|
||||||
|
|
||||||
def fatal(msg: str) -> None:
|
def fatal(err: str | Exception) -> Never:
|
||||||
print(_format_msg(31, f"Fatal: {msg}"), file=sys.stderr)
|
print(_format_msg(31, f"Fatal: {err}"), file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user