Home GnuPG
Diffusion GnuPG 2ea1aebc924c

gpg: New function to printed a detailed error code.
2ea1aebc924cUnpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

gpg: New function to printed a detailed error code.

* g10/misc.c (print_reported_error): New.

Often the user is only interested in a catch all error code like "not
found" but sometimes it is useful to also see the real reason. By
this function this can easily be achieved. Example:

err = search_for_key (keyid)
if (err)
  {
    log_info ("error locating key '%s': %s\n",
              keyid, gpg_strerror (GPG_ERR_NOT_FOUND));
    print_reported_error (err, GPG_ERR_NOT_FOUND);
  }

results in

gpg: error locating key 'foobar': not found
gpg: (reported error: no keyring <keybox>)

where the second line is only printed in verbose mode and if ERR is
not GPG_ERR_NOT_FOUND.

  • Signed-off-by: Werner Koch <wk@gnupg.org>

Details

Provenance
wernerAuthored on Dec 14 2015, 7:35 PM
Parents
rGf369efd67121: gpg: Improve the keyblock cache's transparency.
Branches
Unknown
Tags
Unknown

Event Timeline

Werner Koch <wk@gnupg.org> committed rG2ea1aebc924c: gpg: New function to printed a detailed error code. (authored by Werner Koch <wk@gnupg.org>).Dec 15 2015, 1:40 PM