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
@@ -98,18 +98,18 @@ namespace Echoion::Core
{
auto parsed = Void::Json::parse(body);
if (!parsed) {
return std::unexpected(Api::Error(
return Api::fail(
Api::ErrorCode::ParseError,
std::format("JSON parse error ({}:{}): {}",
parsed.error().line, parsed.error().col,
parsed.error().message)));
parsed.error().message));
}
auto value = Void::Json::from_json<T>(*parsed);
if (!value) {
return std::unexpected(Api::Error(
return Api::fail(
Api::ErrorCode::ParseError,
std::format("JSON decode error: field '{}': {}",
value.error().field, value.error().message)));
value.error().field, value.error().message));
}
return std::move(*value);
}