Include event data in 'field not found' error message

This commit is contained in:
Christophe Bedard 2019-07-30 10:37:59 +02:00
parent b84b5234b3
commit c8e2031760

View file

@ -85,7 +85,7 @@ def get_field(event: DictEvent, field_name: str, default=None, raise_if_not_foun
field_value = event.get(field_name, default)
# If enabled, raise exception as soon as possible to avoid headaches
if raise_if_not_found and field_value is None:
raise AttributeError(f'event field "{field_name}" not found!')
raise AttributeError(f"event field '{field_name}' not found for event: {event}")
return field_value