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 <xemul@scylladb.com>

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Pavel Emelyanov
2026-05-19 13:24:30 +03:00
parent 60aa3e2879
commit a16ae07617

View File

@@ -4409,9 +4409,9 @@ future<std::unordered_map<sstring, table::snapshot_details>> 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::snapshot_details> 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.
//