Use Api::fail() for error returns (241 sites)

Mechanically convert std::unexpected(Api::Error(ErrorCode::X, msg[, src]))
to Api::fail(ErrorCode::X, msg[, src]) across Core. Pure syntax; forwards of
existing errors (std::unexpected(x.error())) are unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
faumarayandClaude Opus 4.8 committed 2026-06-22 22:07:18 +03:00
1 parent f8757d6040
commit 23759899bb
14 files changed
+344 -435

No files matched your search

+4 -4
View File
@@ -15,8 +15,8 @@ namespace Echoion::Core
Api::Result<void> RpcServer::start(uint16_t port)
{
if (running_.exchange(true)) {
return std::unexpected(Api::Error(Api::ErrorCode::AlreadyExists,
"RPC server already running"));
return Api::fail(Api::ErrorCode::AlreadyExists,
"RPC server already running");
}
port_ = port;
@@ -36,9 +36,9 @@ namespace Echoion::Core
return {};
} catch (const std::exception& e) {
running_ = false;
return std::unexpected(Api::Error(
return Api::fail(
Api::ErrorCode::ServiceUnavailable,
std::format("Failed to start RPC server: {}", e.what())));
std::format("Failed to start RPC server: {}", e.what()));
}
}