gpgme: improve error messages
See for full discussion.
@@ -153,8 +153,7 @@ static gpgme_key_t * extractRecipientFromPluginConfig (KeySet * config, Key * er
err = gpgme_get_key (ctx, keyString (gpgRecipientRoot), &key, 0);
if (err)
{
- // TODO: Correct??
- ELEKTRA_SET_INTERNAL_ERRORF (errorKey, "Failed to receive the GPG key. Reason: %s", gpgme_strerror (err));
+ ELEKTRA_SET_VALIDATION_SEMANTIC_ERROR (errorKey, "Failed to read the specified GPG key. Reason: %s", gpgme_strerror (err));
elektraGpgmeKeylistFree (&list);
return NULL;
}
@@ -183,8 +182,7 @@ static gpgme_key_t * extractRecipientFromPluginConfig (KeySet * config, Key * er
err = gpgme_get_key (ctx, keyString (k), &key, 0);
if (err)
{
- // TODO: Correct??
- ELEKTRA_SET_INTERNAL_ERRORF (errorKey, "Failed to receive the GPG key. Reason: %s",
+ ELEKTRA_SET_VALIDATION_SEMANTIC_ERROR (errorKey, "Failed to read the specified GPG key. Reason: %s",
gpgme_strerror (err));
elektraGpgmeKeylistFree (&list);
return NULL;
@@ -260,7 +258,7 @@ static int transferGpgmeDataToElektraKey (gpgme_data_t src, Key * dst, Key * err
readCount = gpgme_data_read (src, buffer, ciphertextLen);
if (readCount != ciphertextLen)
{
- ELEKTRA_SET_INTERNAL_ERRORF (errorKey, "An error during occurred during the data transfer. Reason: %s", strerror (errno));
+ ELEKTRA_SET_INTERNAL_ERRORF (errorKey, "An error occurred during the en/decryption process. Reason: %s", strerror (errno));
returnValue = -1; // failure
goto cleanup;
}
@@ -351,7 +349,7 @@ static int gpgEncrypt (Plugin * handle, KeySet * data, Key * errorKey)
err = gpgme_new (&ctx);
if (err)
{
- ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Failed to create the gpgme context. Reason: %s", gpgme_strerror (err));
+ ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Failed to initialize gpgme. Reason: %s", gpgme_strerror (err));
return -1; // at this point nothing has been initialized
}
@@ -486,7 +484,7 @@ static int gpgDecrypt (ELEKTRA_UNUSED Plugin * handle, KeySet * data, Key * erro
err = gpgme_new (&ctx);
if (err)
{
- ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Failed to the gpgme context. Reason: %s", gpgme_strerror (err));
+ ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Failed to initialize gpgme. Reason: %s", gpgme_strerror (err));
return -1; // at this point nothing has been initialized
}
@@ -602,7 +600,7 @@ int elektraGpgmeCheckconf (Key * errorKey, KeySet * conf)
err = gpgme_new (&ctx);
if (err)
{
- ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Failed to create the gpgme context. Reason: %s", gpgme_strerror (err));
+ ELEKTRA_SET_INSTALLATION_ERRORF (errorKey, "Failed to initialize gpgme. Reason: %s", gpgme_strerror (err));
return -1; // at this point nothing has been initialized
}
