`
high0048
  • 浏览: 24428 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

学会看Erlang的出错信息

阅读更多

今天调试程序,冒出了这段

===ERROR REPORT==== 20-Sep-2010::15:33:53 ===
** Generic server my_bank terminating
** Last message in was {add,"joe",10}
** When Server state == 20496
** Reason for termination ==
** {'function not exported',[{ets,lookup,[]},
                             {my_bank,handle_call,3},
                             {gen_server,handle_msg,5},
                             {proc_lib,init_p_do_apply,3}]}
** exception exit: undef
     in function  ets:lookup/0
        called as ets:lookup()
     in call from my_bank:handle_call/3
     in call from gen_server:handle_msg/5
     in call from proc_lib:init_p_do_apply/3


晕啊,erlang的出错信息太难懂了,都是模式匹配 -_-!

Last message in was {add,"joe",10} ,这是指服务端最后一次收到的信息是{add,"joe",10}

{'function not exported',[{ets,lookup,[]},
                             {my_bank,handle_call,3},
                             {gen_server,handle_msg,5},
                             {proc_lib,init_p_do_apply,3}]}
类似于java的堆栈信息,
这是指,函数未导出,外部调用的函数对外不可见
{ets,lookup,[]}指的是{模块名,函数名,参数}
后面类似。

本质原因是,ets:lookup/0 不存在,标准库只有ets:lookup/2这个函数,所以出错了!



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics