From 8558f80b4077536d6aa46b97328d6df1210e261f Mon Sep 17 00:00:00 2001 From: Richard-Qin-X Date: Thu, 13 Aug 2026 13:18:05 +0800 Subject: [Support] Centralize error context handling --- backend/lib/Support/Error.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'backend/lib/Support') diff --git a/backend/lib/Support/Error.cpp b/backend/lib/Support/Error.cpp index 2bda044..d4793b5 100644 --- a/backend/lib/Support/Error.cpp +++ b/backend/lib/Support/Error.cpp @@ -61,4 +61,9 @@ std::string_view getErrorCodeName(ErrorCode Code) noexcept { Error::Error(ErrorCode Code, std::string Message) : Code(Code), Message(std::move(Message)) {} +Error withErrorContext(const Error &Failure, std::string Context) { + Context.append(Failure.message()); + return Error(Failure.code(), std::move(Context)); +} + } // namespace rcc -- cgit v1.2.3