* [Caml-list] Exceptions and at_exit
@ 2002-06-04 17:45 David Fox
2002-06-04 21:10 ` Remi VANICAT
2002-07-13 13:30 ` David Fox
0 siblings, 2 replies; 5+ messages in thread
From: David Fox @ 2002-06-04 17:45 UTC (permalink / raw)
To: caml-list
I have some at_exit functions that must execute before my program
exits, but I also want to see a traceback of any exception that
occurs. Can I catch the exception, print a traceback like the one you
get when you exit and then call exit? Or can I catch the exception,
execute the at_exit functions, and then re-raise the exception? How
*do* you re-raise an exception, anyway? Do you just catch the
exception and raise it?
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Exceptions and at_exit
2002-06-04 17:45 [Caml-list] Exceptions and at_exit David Fox
@ 2002-06-04 21:10 ` Remi VANICAT
2002-07-13 13:30 ` David Fox
1 sibling, 0 replies; 5+ messages in thread
From: Remi VANICAT @ 2002-06-04 21:10 UTC (permalink / raw)
To: caml-list
David Fox <david@lindows.com> writes:
> I have some at_exit functions that must execute before my program
> exits, but I also want to see a traceback of any exception that
> occurs. Can I catch the exception, print a traceback like the one you
> get when you exit and then call exit? Or can I catch the exception,
> execute the at_exit functions, and then re-raise the exception? How
> *do* you re-raise an exception, anyway? Do you just catch the
> exception and raise it?
for reraising an exception :
try
foo bar
with
x ->
baaz buz;
raise x
but i don't know if this work well with traceback.
--
Rémi Vanicat
vanicat@labri.u-bordeaux.fr
http://dept-info.labri.u-bordeaux.fr/~vanicat
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Caml-list] Exceptions and at_exit
2002-06-04 17:45 [Caml-list] Exceptions and at_exit David Fox
2002-06-04 21:10 ` Remi VANICAT
@ 2002-07-13 13:30 ` David Fox
2002-07-13 20:44 ` William Lovas
1 sibling, 1 reply; 5+ messages in thread
From: David Fox @ 2002-07-13 13:30 UTC (permalink / raw)
To: caml-list
David Fox <david@lindows.com> writes:
> I have some at_exit functions that must execute before my program
> exits, but I also want to see a traceback of any exception that
> occurs. Can I catch the exception, print a traceback like the one you
> get when you exit and then call exit? Or can I catch the exception,
> execute the at_exit functions, and then re-raise the exception? How
> *do* you re-raise an exception, anyway? Do you just catch the
> exception and raise it?
My confusion about re-raising exceptions was caused by the fact that
you get different behavior if you say something like
try ... with
Failure msg -> <do some stuff>; raise (Failure msg)
vs something like
try ... with
exn ->
begin match exn with Failure msg -> <do some stuff> end;
raise exn
In the second case, you are re-raising the exception, in the first
you are raising a new exception and your original traceback is lost.
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-07-14 17:35 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-04 17:45 [Caml-list] Exceptions and at_exit David Fox
2002-06-04 21:10 ` Remi VANICAT
2002-07-13 13:30 ` David Fox
2002-07-13 20:44 ` William Lovas
2002-07-14 15:30 ` Xavier Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox