Skip to content

Commit

Permalink
Fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
yhaliaw committed Jul 6, 2023
1 parent 015bd5e commit e8439ad
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,13 @@ class UpdateRunnerBinEvent(EventBase):


def catch_charm_errors(func: Callable[[CharmT, EventT], None]) -> Callable[[CharmT, EventT], None]:
"""Catch unexpected errors in charm.
This decorator is for unrecoverable errors and sets the charm to
`BlockedStatus`.
"""Catch common errors in charm.
Args:
func: Charm function to be decorated.
Returns:
Decorated charm function with catching unexpected errors.
Decorated charm function with catching common errors.
"""

@functools.wraps(func)
Expand All @@ -81,13 +78,13 @@ def func_with_catch_unexpected_errors(self, event: EventT) -> None:
def catch_action_errors(
func: Callable[[CharmT, ActionEvent], None]
) -> Callable[[CharmT, ActionEvent], None]:
"""Catch unexpected errors in actions.
"""Catch common errors in actions.
Args:
func: Action function to be decorated.
Returns:
Decorated charm function with catching unexpected errors.
Decorated charm function with catching common errors.
"""

@functools.wraps(func)
Expand Down Expand Up @@ -202,7 +199,7 @@ def _ensure_service_health(self) -> None:
except SubprocessError:
logger.exception("Found inactive repo-policy-compliance service")
execute_command(["/usr/bin/systemctl", "restart", "repo-policy-compliance"])
logger.exception("Restart repo-policy-compliance service")
logger.info("Restart repo-policy-compliance service")
raise

def _get_runner_manager(
Expand Down

0 comments on commit e8439ad

Please sign in to comment.