Skip to content

Commit

Permalink
Add NoReturn overload for log_exception with raise_error=True
Browse files Browse the repository at this point in the history
  • Loading branch information
jix committed Oct 12, 2023
1 parent 5d72ac1 commit 8803d14
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/yosys_mau/task_loop/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,16 @@ def log_error(*args: Any, cls: type[LogEvent] = LogEvent, raise_error: bool = Tr
_already_logged: dict[int, tuple[BaseException, LoggedError]] = {}


@overload
def log_exception(exception: BaseException, raise_error: Literal[True] = True) -> NoReturn:
...


@overload
def log_exception(exception: BaseException, raise_error: Literal[False]) -> LoggedError:
...


def log_exception(exception: BaseException, raise_error: bool = True) -> LoggedError:
"""Produce error log output for an exception and optionally raise a `LoggedError`.
Expand Down

0 comments on commit 8803d14

Please sign in to comment.