Skip to content

Commit

Permalink
Cache error_text() instead of check_error() (#552)
Browse files Browse the repository at this point in the history
In the case of an error, `check_error()` raises an exception and
there is no return value to cache.

Closes #551
  • Loading branch information
mthuurne authored Nov 13, 2024
1 parent 0dcce7b commit e1d2b3d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion snap7/error.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ def inner(*args: tuple[Any, ...], **kwargs: dict[Hashable, Any]) -> None:
return middle


@cache
def check_error(code: int, context: Context = "client") -> None:
"""Check if the error code is set. If so, a Python log message is generated
and an error is raised.
Expand All @@ -143,6 +142,7 @@ def check_error(code: int, context: Context = "client") -> None:
raise RuntimeError(error)


@cache
def error_text(error: int, context: Context = "client") -> bytes:
"""Returns a textual explanation of a given error number
Expand Down

0 comments on commit e1d2b3d

Please sign in to comment.