0

我有这样的代码:

index('GET', []) ->
    Users = boss_db:find(consumer, []),
    {json, [{"users", Users}]}.

我有一个错误:

{function_clause,
    [{boss_json,json_data1,
         [[{consumer,"consumer-52a3024b4346e12118000001",<<"qwe">>,
               <<"qwe">>},
           {consumer,"consumer-52a302c84346e12118000002",<<"asd">>,
               <<"asd">>},
           {consumer,"consumer-52a305264346e12118000003",<<"zxc">>,
               <<"zxc">>}],
          ["user"],
          []],
         [{file,"src/boss/boss_json.erl"},{line,23}]}

问题出在哪里?如何解决?

4

1 回答 1

1

可能是最后一行的错误,users必须是原子,而不是字符串:

 {json, [{users, Users}]}.
于 2013-12-07T19:50:14.077 回答