anchor.diff:          TimeSeries ->
               FilteredTimeSeries = lists:foldl(fun(MetricId, Acc) ->
                   case maps:get(MetricId, TimeSeries, undefined) of
  -                    undefined when ErrorHandlingMode =:= fail_function -> throw({error, metric_not_found});
  +                    undefined when ErrorHandlingMode =:= fail_if_metric_is_missing -> throw({error, metric_not_found});
                       undefined -> Acc;
                       Metric -> maps:put(MetricId, Metric, Acc)
                   end
  
positive.code:     ?CATCH_UPDATE_UNEXPECTED_ERRORS(
          begin
              {TimeSeriesCollectionHeads, PersistenceCtx} = ts_persistence:init_for_existing_collection(Ctx, Id, Batch),
              SelectedHeads = select_heads(TimeSeriesCollectionHeads, MetricsToDelete, ignore),
              PersistenceCtxAfterDelete = delete_time_series(maps:to_list(SelectedHeads), false, PersistenceCtx),
  
              UpdatedTimeSeriesCollectionHeads = ts_persistence:get_time_series_collection_heads(PersistenceCtxAfterDelete),
  
negative.code: select_heads(TimeSeriesCollectionHeads, [TimeSeriesId | Tail], ErrorHandlingMode) ->
      Ans = select_heads(TimeSeriesCollectionHeads, Tail, ErrorHandlingMode),
      case maps:get(TimeSeriesId, TimeSeriesCollectionHeads, undefined) of
          undefined when ErrorHandlingMode =:= fail_if_metric_is_missing -> throw({error, time_series_not_found});
          undefined -> Ans;
          TimeSeries -> maps:put(TimeSeriesId, TimeSeries, Ans)
      end;
  