log.py: don't inject log_ref if the operation didnt start yet

This commit is contained in:
Alexandre Aubin 2021-04-01 15:55:46 +02:00
parent 4f44df388e
commit cd1f64383b

View file

@ -636,7 +636,7 @@ class OperationLogger(object):
# we want to inject the log ref in the exception, such that it may be
# transmitted to the webadmin which can then redirect to the appropriate
# log page
if isinstance(error, Exception) and not isinstance(error, YunohostValidationError):
if self.started_at and isinstance(error, Exception) and not isinstance(error, YunohostValidationError):
error.log_ref = self.name
if self.ended_at is not None or self.started_at is None: