Files
scylladb/replica/exceptions.cc
Taras Veretilnyk 72c472a3ae replica: introduce large_data_exception
Add large_data_exception to the replica exception hierarchy so that
write-path guardrails can reject mutations that target partitions
already known to exceed configured size limits.

Wire it through exception_variant / IDL so it propagates from replica
to coordinator, where storage_proxy re-throws it as a mutation_write_failure.
2026-05-13 12:53:34 +02:00

46 lines
1.1 KiB
C++

/*
* Copyright 2022-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.1
*/
#include <stdexcept>
#include <type_traits>
#include "replica/exceptions.hh"
namespace replica {
exception_variant try_encode_replica_exception(std::exception_ptr eptr) {
try {
std::rethrow_exception(std::move(eptr));
} catch (rate_limit_exception&) {
return rate_limit_exception();
} catch (const stale_topology_exception& e) {
return e;
} catch (abort_requested_exception&) {
return abort_requested_exception();
} catch (const critical_disk_utilization_exception& e) {
return e;
} catch (const large_data_exception& e) {
return e;
} catch (...) {
return no_exception{};
}
}
std::exception_ptr exception_variant::into_exception_ptr() noexcept {
return std::visit([] <typename Ex> (Ex&& ex) {
if constexpr (std::is_same_v<Ex, unknown_exception>) {
return std::make_exception_ptr(std::runtime_error("unknown exception"));
} else {
return std::make_exception_ptr(std::move(ex));
}
}, std::move(reason));
}
}