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


3.3.3 Error Codes

The library libgpg-error defines many error values. The following list includes the most important error codes.

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 occurred, 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_EFOO 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.
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 data was expected where no data was found.
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_WRONG_KEY_USAGE
This value indicates that a key is not used appropriately.
GPG_ERR_NO_SECKEY
This value indicates that no secret key for the user ID is available.
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_NOT_OPERATIONAL
This value means that the library is not yet in state which allows to use this function. This error code is in particular returned if Libgcrypt is operated in FIPS mode and the internal state of the library does not yet or not anymore allow the use of a service.

This error code is only available with newer libgpg-error versions, thus you might see “invalid error code” when passing this to gpg_strerror. The numeric value of this error code is 176.

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 Libgcrypt 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.