diff options
author | Saturneric <[email protected]> | 2021-09-10 23:58:09 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-09-10 16:06:21 +0000 |
commit | 4e076fa1982812ea7d1222c7e981879799ca8853 (patch) | |
tree | 1b96ae4a6296ca0f7b9df8ce3a3c7339643bf1f0 /src/gpg/GpgConstants.cpp | |
parent | Adjust the code structure. (diff) | |
download | GpgFrontend-4e076fa1982812ea7d1222c7e981879799ca8853.tar.gz GpgFrontend-4e076fa1982812ea7d1222c7e981879799ca8853.zip |
Continue to optimize and improve the code.
Diffstat (limited to '')
-rw-r--r-- | src/gpg/GpgConstants.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gpg/GpgConstants.cpp b/src/gpg/GpgConstants.cpp index 937033eb..2ba04ed2 100644 --- a/src/gpg/GpgConstants.cpp +++ b/src/gpg/GpgConstants.cpp @@ -23,6 +23,7 @@ */ #include "gpg/GpgConstants.h" +#include <gpg-error.h> const char *GpgFrontend::GpgConstants::PGP_CRYPT_BEGIN = "-----BEGIN PGP MESSAGE-----"; @@ -40,7 +41,6 @@ const char *GpgFrontend::GpgConstants::GPG_FRONTEND_SHORT_CRYPTO_HEAD = "GpgF_Scpt://"; gpgme_error_t GpgFrontend::check_gpg_error(gpgme_error_t err) { - // if (gpgmeError != GPG_ERR_NO_ERROR && gpgmeError != GPG_ERR_CANCELED) { if (gpg_err_code(err) != GPG_ERR_NO_ERROR) { LOG(ERROR) << "[Error " << gpg_err_code(err) << "] Source: " << gpgme_strsource(err) @@ -49,10 +49,19 @@ gpgme_error_t GpgFrontend::check_gpg_error(gpgme_error_t err) { return err; } +gpg_err_code_t GpgFrontend::check_gpg_error_2_err_code(gpgme_error_t err) { + auto err_code = gpg_err_code(err); + if (err_code != GPG_ERR_NO_ERROR) { + LOG(ERROR) << "[Error " << gpg_err_code(err) + << "] Source: " << gpgme_strsource(err) + << " Description: " << gpgme_strerror(err); + } + return err_code; +} + // error-handling gpgme_error_t GpgFrontend::check_gpg_error(gpgme_error_t err, const std::string &comment) { - // if (gpgmeError != GPG_ERR_NO_ERROR && gpgmeError != GPG_ERR_CANCELED) { if (gpg_err_code(err) != GPG_ERR_NO_ERROR) { LOG(ERROR) << "[Error " << gpg_err_code(err) << "] Source: " << gpgme_strsource(err) |