fix: allow logging exceptions + Never fatal return

This commit is contained in:
2 * r + 2 * t
2026-06-13 20:18:48 +10:00
parent 14732e9850
commit 586f4d9665
+5 -4
View File
@@ -1,4 +1,5 @@
import sys
from typing import Never
def log_exception(func):
@@ -33,12 +34,12 @@ def warn(msg: str) -> None:
print(_format_msg(33, f"Warning: {msg}"))
def error(msg: str) -> None:
print(_format_msg(31, f"Error: {msg}"), file=sys.stderr)
def error(err: str | Exception) -> None:
print(_format_msg(31, f"Error: {err}"), file=sys.stderr)
def fatal(msg: str) -> None:
print(_format_msg(31, f"Fatal: {msg}"), file=sys.stderr)
def fatal(err: str | Exception) -> Never:
print(_format_msg(31, f"Fatal: {err}"), file=sys.stderr)
sys.exit(1)