[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: correct way to anticipate decryption failures
From: |
John Mastro |
Subject: |
Re: correct way to anticipate decryption failures |
Date: |
Tue, 15 Sep 2015 16:01:33 -0700 |
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