Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2010-06-22 (15:17)
From: Eric Cooper <ecc@c...>
Subject: Re: [Caml-list] Re: exception error trace back in ocaml
On 21-06-2010, lin hong <> 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 "", line 33, characters 10-11
> Called from file "", line 74, characters 24-34
> But that's all I got, both and are ocaml
> source code, I still don't know which part of my code trigger it. Also,
> in
> 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

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