From 2e65a5b6280f36c6c2f9fae94c92a608a903573c Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 21 Jun 2024 16:05:58 +0200 Subject: [PATCH] Filter not found should save error screenshot --- changedetectionio/processors/text_json_diff.py | 5 +++-- changedetectionio/update_worker.py | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/changedetectionio/processors/text_json_diff.py b/changedetectionio/processors/text_json_diff.py index 1d60be63..7a13085d 100644 --- a/changedetectionio/processors/text_json_diff.py +++ b/changedetectionio/processors/text_json_diff.py @@ -21,7 +21,8 @@ description = 'Detects all text changes where possible' json_filter_prefixes = ['json:', 'jq:', 'jqraw:'] class FilterNotFoundInResponse(ValueError): - def __init__(self, msg): + def __init__(self, msg, screenshot=None): + self.screenshot = screenshot ValueError.__init__(self, msg) @@ -188,7 +189,7 @@ class perform_site_check(difference_detection_processor): append_pretty_line_formatting=not watch.is_source_type_url) if not html_content.strip(): - raise FilterNotFoundInResponse(include_filters_rule) + raise FilterNotFoundInResponse(msg=include_filters_rule, screenshot=self.fetcher.screenshot) if has_subtractive_selectors: html_content = html_tools.element_removal(subtractive_selectors, html_content) diff --git a/changedetectionio/update_worker.py b/changedetectionio/update_worker.py index f17d3a28..4aeb227e 100644 --- a/changedetectionio/update_worker.py +++ b/changedetectionio/update_worker.py @@ -340,6 +340,7 @@ class update_worker(threading.Thread): err_text = "Warning, no filters were found, no change detection ran - Did the page change layout? update your Visual Filter if necessary." self.datastore.update_watch(uuid=uuid, update_obj={'last_error': err_text}) + watch.save_screenshot(screenshot=e.screenshot, as_error=True) # Only when enabled, send the notification if self.datastore.data['watching'][uuid].get('filter_failure_notification_send', False):