浏览 2238 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2009-04-16
最后修改:2009-09-14
The run-time system's error reports tell you which function crashed, but not the line number. Consider this module: -module(crash). -export([f/0]). f() -> g(). g() -> A = 4, b = 5, % Error is on this line. A. 3> crash:f(). ** exited: {{badmatch,5},[{crash,g,0},{shell,exprs,6},{shell,eval_loop,3}]} ** The crash message tells us that the crash was in the function crash:g/1, and that it was a badmatch. For programs with short functions, this is enough information for an experienced programmer to find the problem. In cases where you want more information, there are two options. The first is to use the erlang debugger to single-step the program. Another option is to compile your code using the smart exceptions package, available from the jungerl. Smart exceptions then provide line number information: 4> c(crash, [{parse_transform, smart_exceptions}]). {ok,crash} 5> crash:f(). ** exited: {{crash,g,0},{line,9},match,[5]} ** smart_exception包在这里下载 http://pepper.sherry.jp/mikage/smart_exceptions.tar.gz 这个包的年代比较久了 makefile有些问题 这样编译 erlc *.erl 一堆警告不怕。 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2009-07-21
我尝试了一下,发现有2个文件编译不过:mapform0.erl和smart_exceptions.erl。
我是windows环境,R13B01。 错误是 when constant(C) 这句造成的:illegal guard expression。 不知道应该怎么修改? |
|
返回顶楼 | |
发表时间:2009-07-21
用R12B
|
|
返回顶楼 | |