Version française
Home     About     Download     Resources     Contact us    
Browse thread
line number in exception history?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Eijiro Sumii <eijiro.sumii@g...>
Subject: Re: line number in exception history?
P.S.  The following variant is even more strange.  (Look at the
"re-raised" line, please.)

> cat foo.ml
let fooFunction x =
  if x > 0 then x - 1
  else raise (invalid_arg "Give me positive!")
> cat bar.ml
let barFunction x =
  let y = x + 1 in
  Foo.fooFunction y
> cat main.ml
let f () = ()

let test () =
  try
    Bar.barFunction (-10)
  with e -> raise e

let g y = y + 1

let () =
  f ();
  let ret = test () in
  print_int (ret + 100)
> ocamlc -g foo.ml bar.ml main.ml -o test
> env OCAMLRUNPARAM=b ./test
Fatal error: exception Invalid_argument("Give me positive!")
Raised at file "pervasives.ml", line 22, character 17
Re-raised at file "foo.ml", line 3, character 46
Called from file "main.ml", line 5, character 25
Re-raised at file "main.ml", line 1, character 11
Called from file "main.ml", line 13, character 2