Version française
Home     About     Download     Resources     Contact us    
Browse thread
exception error trace back in ocaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eric Cooper <ecc@c...>
Subject: Re: [Caml-list] Re: exception error trace back in ocaml
On 21-06-2010, lin hong <lhong@amnh.org> wrote:
> I have problem getting a full traceback of some exception error. The
> traceback looks like this:
>
> Fatal error: exception Invalid_argument("index out of bounds")
> Raised at file "camlinternalLazy.ml", line 33, characters 10-11
> Called from file "list.ml", line 74, characters 24-34
>
> But that's all I got, both camlinternalLazy.ml and list.ml are ocaml
> source code, I still don't know which part of my code trigger it. Also,
> in
> camlinternalLazy.ml line 33, there is a "try .... with e -> raise e", is
> this the reason I don't have a full traceback -- Maybe something else
> catch the "raise e" ?  Any idea?

That exception was raised when forcing a lazy value (Lazy.force catches
it and re-raises it).  So you'll need to wrap the expression following
the "lazy" keyword with a handler for Invalid_argument, and you might
be able to use Printexc.print_backtrace from there.  But I don't know
why the standard backtrace printer can't "see" into the closure being
forced.

-- 
Eric Cooper             e c c @ c m u . e d u