mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Fix log_ref injection
This commit is contained in:
parent
9e032b04bc
commit
11c50c0187
1 changed files with 6 additions and 5 deletions
|
@ -631,17 +631,18 @@ class OperationLogger(object):
|
|||
"""
|
||||
Close properly the unit operation
|
||||
"""
|
||||
if self.ended_at is not None or self.started_at is None:
|
||||
return
|
||||
if error is not None and not isinstance(error, str):
|
||||
error = str(error)
|
||||
|
||||
# When the error happen's in the is_unit_operation try/except,
|
||||
# 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):
|
||||
error.log_ref = operation_logger.name
|
||||
error.log_ref = self.name
|
||||
|
||||
if self.ended_at is not None or self.started_at is None:
|
||||
return
|
||||
if error is not None and not isinstance(error, str):
|
||||
error = str(error)
|
||||
|
||||
self.ended_at = datetime.utcnow()
|
||||
self._error = error
|
||||
|
|
Loading…
Add table
Reference in a new issue