Skip to content

Commit

Permalink
Avoid mixing explicit and implicit returns.
Browse files Browse the repository at this point in the history
Address code-QL findings.

Signed-off-by: Nicola Sirena <[email protected]>
  • Loading branch information
NSsirena committed Oct 23, 2023
1 parent cb724dd commit 9385fc6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/slurm_plugin/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ def log_exception(
def _log_exception(function):
@functools.wraps(function)
def wrapper(*args, **kwargs):
wrapped = None
try:
return function(*args, **kwargs)
wrapped = function(*args, **kwargs)
except catch_exception as e:
logger.log(log_level, "Failed when %s with exception %s, message: %s", action_desc, type(e).__name__, e)
if raise_on_error:
Expand All @@ -97,6 +98,8 @@ def wrapper(*args, **kwargs):
else:
raise

return wrapped

return wrapper

return _log_exception
Expand Down

0 comments on commit 9385fc6

Please sign in to comment.