Version française
Home     About     Download     Resources     Contact us    
Browse thread
stack trace on exception in top-level
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Sam Steingold <sds@g...>
Subject: stack trace on exception in top-level
how do I get backtraces on exceptions in then top-level?
E.g.:

# let f x = invalid_arg (sprintf "error: %d" x) ;;
val f : int -> 'a = <fun>
# let g x = f (x+1) ;;
val g : int -> 'a = <fun>
# let h x = g (x+1) ;;
val h : int -> 'a = <fun>
# h 1;;
Exception: Invalid_argument "error: 3".

I want to see something like:
h called g on line 1
g called f on line 1
f raised invalid_argument on line 1

thanks.
Sam,