From a16ae0761731ac8790746b479401aa1995320bcf Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Tue, 19 May 2026 13:24:30 +0300 Subject: [PATCH] error_injection: Convert handler-throw injections to lambda-throw style Replace inject(name, handler_lambda_that_throws).get() with the simpler inject(name, [] { throw ...; }) pattern used consistently across the codebase. The handler overload is unnecessary when the injection just throws immediately without waiting. Converted injections: - get_snapshot_details (table.cc) - per-snapshot-get_snapshot_details (table.cc) Signed-off-by: Pavel Emelyanov Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- replica/table.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/replica/table.cc b/replica/table.cc index 376aa09baa..db0215b607 100644 --- a/replica/table.cc +++ b/replica/table.cc @@ -4409,9 +4409,9 @@ future> table::get_snapshot auto& sd = all_snapshots.at(snapshot_name); sd.total += details.total; sd.live += details.live; - utils::get_local_injector().inject("get_snapshot_details", [&] (auto& handler) -> future<> { + utils::get_local_injector().inject("get_snapshot_details", [] { throw std::runtime_error("Injected exception in get_snapshot_details"); - }).get(); + }); } } return all_snapshots; @@ -4439,9 +4439,9 @@ future table::get_snapshot_details(fs::path snapshot_di auto sd = co_await io_check(file_stat, snapshot_directory, name, follow_symlink::no); auto size = sd.allocated_size; - utils::get_local_injector().inject("per-snapshot-get_snapshot_details", [&] (auto& handler) -> future<> { + utils::get_local_injector().inject("per-snapshot-get_snapshot_details", [] { throw std::runtime_error("Injected exception in per-snapshot-get_snapshot_details"); - }).get(); + }); // The manifest and schema.cql files are the only files expected to be in this directory not belonging to the SSTable. //