Next: , Previous: Error Sources, Up: Error Handling


5.3 Error Codes

The library libgpg-error defines many error values. Most of them are not used by GPGME directly, but might be returned by GPGME because it received them from the crypto engine. The below list only includes such error codes that have a specific meaning in GPGME, or which are so common that you should know about them.

GPG_ERR_EOF
This value indicates the end of a list, buffer or file.
GPG_ERR_NO_ERROR
This value indicates success. The value of this error code is 0. Also, it is guaranteed that an error value made from the error code 0 will be 0 itself (as a whole). This means that the error source information is lost for this error code, however, as this error code indicates that no error occured, this is generally not a problem.
GPG_ERR_GENERAL
This value means that something went wrong, but either there is not enough information about the problem to return a more useful error value, or there is no separate error value for this type of problem.
GPG_ERR_ENOMEM
This value means that an out-of-memory condition occurred.
GPG_ERR_E...
System errors are mapped to GPG_ERR_FOO where FOO is the symbol for the system error.
GPG_ERR_INV_VALUE
This value means that some user provided data was out of range. This can also refer to objects. For example, if an empty gpgme_data_t object was expected, but one containing data was provided, this error value is returned.
GPG_ERR_UNUSABLE_PUBKEY
This value means that some recipients for a message were invalid.
GPG_ERR_UNUSABLE_SECKEY
This value means that some signers were invalid.
GPG_ERR_NO_DATA
This value means that a gpgme_data_t object which was expected to have content was found empty.
GPG_ERR_CONFLICT
This value means that a conflict of some sort occurred.
GPG_ERR_NOT_IMPLEMENTED
This value indicates that the specific function (or operation) is not implemented. This error should never happen. It can only occur if you use certain values or configuration options which do not work, but for which we think that they should work at some later time.
GPG_ERR_DECRYPT_FAILED
This value indicates that a decryption operation was unsuccessful.
GPG_ERR_BAD_PASSPHRASE
This value means that the user did not provide a correct passphrase when requested.
GPG_ERR_CANCELED
This value means that the operation was canceled.
GPG_ERR_INV_ENGINE
This value means that the engine that implements the desired protocol is currently not available. This can either be because the sources were configured to exclude support for this engine, or because the engine is not installed properly.
GPG_ERR_AMBIGUOUS_NAME
This value indicates that a user ID or other specifier did not specify a unique key.
GPG_ERR_WRONG_KEY_USAGE
This value indicates that a key is not used appropriately.
GPG_ERR_CERT_REVOKED
This value indicates that a key signature was revoced.
GPG_ERR_CERT_EXPIRED
This value indicates that a key signature expired.
GPG_ERR_NO_CRL_KNOWN
This value indicates that no certificate revocation list is known for the certificate.
GPG_ERR_NO_POLICY_MATCH
This value indicates that a policy issue occured.
GPG_ERR_NO_SECKEY
This value indicates that no secret key for the user ID is available.
GPG_ERR_MISSING_CERT
This value indicates that a key could not be imported because the issuer certificate is missing.
GPG_ERR_BAD_CERT_CHAIN
This value indicates that a key could not be imported because its certificate chain is not good, for example it could be too long.
GPG_ERR_UNSUPPORTED_ALGORITHM
This value means a verification failed because the cryptographic algorithm is not supported by the crypto backend.
GPG_ERR_BAD_SIGNATURE
This value means a verification failed because the signature is bad.
GPG_ERR_NO_PUBKEY
This value means a verification failed because the public key is not available.
GPG_ERR_USER_1
GPG_ERR_USER_2
...
GPG_ERR_USER_16
These error codes are not used by any GnuPG component and can be freely used by other software. Applications using GPGME might use them to mark specific errors returned by callback handlers if no suitable error codes (including the system errors) for these errors exist already.