help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: correct way to anticipate decryption failures


From: Rasmus
Subject: Re: correct way to anticipate decryption failures
Date: Wed, 16 Sep 2015 01:06:36 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

John Mastro <john.b.mastro@gmail.com> writes:

> 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)))

Indeed, this works nicely,

    emacs -q --eval "(progn (require 'auth-source) (with-demoted-errors \"Auth 
source error: %s\" (auth-source-search :host \"worldwide.net\" :user \"rasmus\" 
:max 1 :require '(:user :secret))))"

Thanks!

Rasmus

-- 
It was you, Jezebel, it was you




reply via email to

[Prev in Thread] Current Thread [Next in Thread]