[Discover] Refactor on_save_search to improve error handling #139511
Labels
chore
Feature:Discover
Discover Application
impact:low
Addressing this issue will have a low level of impact on the quality/strength of our product.
loe:small
Small Level of Effort
refactoring
Team:DataDiscovery
Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL.
Currently the approach
on_save_search
uses includes modifying the search object in place, attempting to save, and rolling back the modified properties on failure.This approach is brittle since it's easy to forget to roll back the properties on failure. Instead we should clone the object before changing the properties, attempt the save, and only update the original search on success.
Originally posted by @kertal in #136162 (comment)
The text was updated successfully, but these errors were encountered: