aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--lang/cpp/src/context.cpp7
-rw-r--r--lang/cpp/src/error.h1
3 files changed, 12 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index c317d2f3..0faf410e 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,9 @@ Noteworthy changes in version 1.24.0 (unrelease)
* cpp: Provide information about designated revocation keys for a Key.
[T7118]
+ * cpp: Add safer member function returning text describing an error.
+ [T5960]
+
* qt: Install headers for Qt 5 and Qt 6 in separate folders. [T7161]
* qt: Allow reading the data to decrypt/encrypt/sign/verify directly from
@@ -39,6 +42,7 @@ Noteworthy changes in version 1.24.0 (unrelease)
cpp: Key::revocationKey NEW.
cpp: Key::numRevocationKeys NEW.
cpp: Key::revocationKeys NEW.
+ cpp: Error::asStdString NEW.
qt: DecryptVerifyJob::setInputFile NEW.
qt: DecryptVerifyJob::inputFile NEW.
qt: DecryptVerifyJob::setOutputFile NEW.
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 99e354df..4882c80c 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -130,6 +130,13 @@ const char *Error::asString() const
return mMessage.c_str();
}
+std::string Error::asStdString() const
+{
+ std::string message;
+ format_error(static_cast<gpgme_error_t>(mErr), message);
+ return message;
+}
+
int Error::code() const
{
return gpgme_err_code(mErr);
diff --git a/lang/cpp/src/error.h b/lang/cpp/src/error.h
index d1367046..bc970e36 100644
--- a/lang/cpp/src/error.h
+++ b/lang/cpp/src/error.h
@@ -48,6 +48,7 @@ public:
const char *source() const;
const char *asString() const;
+ std::string asStdString() const;
int code() const;
int sourceID() const;