From 586f4d9665ca61726528d7b0af45af9666279a4d Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Sat, 13 Jun 2026 20:18:48 +1000 Subject: [PATCH] fix: allow logging exceptions + Never fatal return --- src/caelestia/utils/io.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/caelestia/utils/io.py b/src/caelestia/utils/io.py index 6eda9e7..0a824fd 100644 --- a/src/caelestia/utils/io.py +++ b/src/caelestia/utils/io.py @@ -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)