From 321c8a0254f4729ff1ffe56956fb049555272321 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= Date: Fri, 22 Apr 2022 17:26:17 +0200 Subject: cpp: Allow changing the error of a result * lang/cpp/src/result.h (class Result): Add member function setError. -- This can be used to replace the error of a result with a more suitable error. GnuPG-bug-id: 5939 --- lang/cpp/src/result.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lang/cpp/src') diff --git a/lang/cpp/src/result.h b/lang/cpp/src/result.h index 5ed52a89..a587afbe 100644 --- a/lang/cpp/src/result.h +++ b/lang/cpp/src/result.h @@ -50,6 +50,14 @@ public: { return mError; } + /** + * Replaces the error set during construction with \p error. + * Use with care, e.g. to set a more suitable error. + */ + void setError(const Error &error) + { + mError = error; + } protected: Error mError; -- cgit v1.2.3