Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a flag which indicates whether the action failed #427

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions eliot/_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,21 @@ def __init__(self, logger, task_uuid, task_level, action_type, serializers=None)
}
self._serializers = serializers
self._finished = False
self._failed = False

@property
def task_uuid(self):
"""
@return str: the current action's task UUID.
"""
return self._identification[TASK_UUID_FIELD]

@property
def failed(self):
"""
@return bool: indicates whether during the action an exception was raised.
"""
return self._failed

def serialize_task_id(self):
"""
Expand Down Expand Up @@ -327,6 +335,7 @@ def finish(self, exception=None):
if self._serializers is not None:
serializer = self._serializers.success
else:
self._failed = True
fields = _error_extraction.get_fields_for_exception(self._logger, exception)
fields[EXCEPTION_FIELD] = "%s.%s" % (
exception.__class__.__module__,
Expand Down