[erlang-questions] Mismatch between dbg output and source code
Juan Puig Martínez
juan@REDACTED
Tue Apr 14 22:28:48 CEST 2015
I’m debugging a cause clause exception thrown inside the following function:
create_nonce(DeviceId, Reason, Details, Message, Req) ->
case tmc_nonce:get_nonce(DeviceId) of
{error, memcached_unavailable = Reason} ->
(…);
{error, Reason} ->
(…);
{ok, Nonce} ->
(…)
end.
As you see in the output from dbg below, the function claims a case clause {error, memcached_unavailable} not being handled.
Apr 14 20:08:06 juan-standalone docker[5157]: (<0.3308.0>) call tmc_auth_middleman:create_nonce(...)
Apr 14 20:08:06 juan-standalone docker[5157]: (<0.3308.0>) call tmc_nonce:get_nonce(<<246,135,71,188,226,225,17,228,179,150,14,124,0,0,28,12>>)
Apr 14 20:08:06 juan-standalone docker[5157]: (<0.3308.0>) returned from tmc_nonce:get_nonce/1 -> {error,
Apr 14 20:08:06 juan-standalone docker[5157]: memcached_unavailable}
Apr 14 20:08:06 juan-standalone docker[5157]: (<0.3308.0>) exception_from {tmc_auth_middleman,create_nonce,5} {error,{case_clause,{error,memcached_unavailable}}}
I’m double checked the beam loaded by the VM is correct (given the compilation time) and I’ve used `recon:source/1` to obtain source code based on the loaded beam (thanks to the debug_info flag). Below is the trimmed output (I’ve removed noise for simplicity):
create_nonce(DeviceId, Reason, Details, Message, Req) ->\n case tmc_nonce:get_nonce(DeviceId) of\n {error, memcached_unavailable = Reason} ->\n\t (…);\n {error, Reason} ->\n\t (...);\n {ok, Nonce} ->\n\t (...)\n end.
Knowing that this is the real code being executed, how could it possibly throw that exception? Is there other debugging levels I could use to understand why the mismatch happens?
Thanks,
/Juan
More information about the erlang-questions
mailing list