From: John Mastro <john.b.mastro@gmail.com>
To: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: correct way to anticipate decryption failures
Date: Tue, 15 Sep 2015 16:01:33 -0700 [thread overview]
Message-ID: <CAOj2CQSPUxeGHa23kCHVYm8bz2D-dDePWnMOUpjqXzRiNmUfkQ@mail.gmail.com> (raw)
In-Reply-To: <87y4g78fkh.fsf@gmx.us>
Rasmus <rasmus@gmx.us> wrote:
> What is the correct way to handle decryption errors when using
> auth-source? I have something like,
>
> (auth-source-search :host "worldwide.net"
> :user "rasmus"
> :max 1 :require '(:user :secret))
>
> This throws a decryption error when I haven't plugged in my (physical)
> security token.
>
> Depending on the arguments, sometimes this is called at init time causing
> my daemon window to vanish, which is sort of annoying.
>
> Should I ignore-errors or is there a better way to test if I'm currently
> able to decrypt .authinfo.gpg? Could I re-throw the warning without it
> being an error?
You can probably use `with-demoted-errors'. Something like:
(with-demoted-errors "Auth source error: %s"
(auth-source-search :host "worldwide.net"
:user "rasmus"
:max 1 :require '(:user :secret)))
It catches the error and simply prints the message.
--
john
next prev parent reply other threads:[~2015-09-15 23:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-15 22:48 correct way to anticipate decryption failures Rasmus
2015-09-15 23:01 ` John Mastro [this message]
2015-09-15 23:06 ` Rasmus
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOj2CQSPUxeGHa23kCHVYm8bz2D-dDePWnMOUpjqXzRiNmUfkQ@mail.gmail.com \
--to=john.b.mastro@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).