I am trying to get a record from a database table using match_object. Here is a code snippet.
RowIsv = #isv{appguid=string:to_upper(Appguid), _='_'},
F = fun() -> mnesia:match_object(RowIsv) end,
{atomic, [R]} = mnesia:transaction(F),
When the a record with appguid
exists in the isv table, the mnesia:transaction
call succeeds and I am able to get the record in R. When the record doesn't exist, I get:
2015-04-15 14:08:30.715 [error] <0.1336.0>@ejabberd_hooks:run_fold1:356 {{badmatch,{atomic,[]}},[{ejabberd_auth_internal,get_max_device_count,1,[{file,"src/\
ejabberd_auth_internal.erl"},{line,186}]},{ejabberd_auth_internal,try_register,3,[{file,"src/ejabberd_auth_internal.erl"},{line,236}]},{lists,foldl,3,[{file\
,"lists.erl"},{line,1261}]},{ejabberd_auth,try_register,3,[{file,"src/ejabberd_auth.erl"},{line,199}]},{mod_register,try_register,5,[{file,"src/mod_register\
.erl"},{line,385}]},{mod_register,try_register_or_set_password,9,[{file,"src/mod_register.erl"},{line,327}]},{mod_register,unauthenticated_iq_register,4,[{f\
ile,"src/mod_register.erl"},{line,82}]},{ejabberd_hooks,run_fold1,4,[{file,"src/ejabberd_hooks.erl"},{line,352}]}]}
Am I doing something wrong? my code doesn't continue from the point where I make the match_object call. I want to have different behavior when the record doesn't exist. Right now all I get is an error 503 on the client.
Thanks.
I figured out what I was
I figured out what I was doing wrong.
Hi, you should explain here
Hi, you should explain here the mistake, it may be useful to someone else.