[erlang-questions] Mismatch between dbg output and source code

Juan Puig Martínez <>
Wed Apr 15 19:01:20 CEST 2015


Good catch! I totally ignored that ‘Reason’ was passed from another context with different semantics.

> On Apr 14, 2015, at 9:31 PM, Björn Gustavsson <> wrote:
> 
> On Tue, Apr 14, 2015 at 10:28 PM, Juan Puig Martínez <> wrote:
>> I’m debugging a cause clause exception thrown inside the following function:
>> 
>> create_nonce(DeviceId, Reason, Details, Message, Req) ->
> 
> What is the value of Reason passed into the function?
> 
>>    case tmc_nonce:get_nonce(DeviceId) of
>>        {error, memcached_unavailable = Reason} ->
> 
> This clause will only be executed if the value of Reason
> given as a function argument is memcached_unavailable.
> 
> You probably want to change the line to something like:
> 
>         {error, memcached_unavailable = EReason} ->
> 
>>            (…);
>>        {error, Reason} ->
> 
> Same problem here.
> 
>>            (…);
>>        {ok, Nonce} ->
>>            (…)
>>    end.
> 
> /Bjorn
> -- 
> Björn Gustavsson, Erlang/OTP, Ericsson AB

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150415/ef6293f8/attachment.html>


More information about the erlang-questions mailing list