<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/11/ff72925752fe0498aceed8943c28dec1"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-11-06T09:50:36"
  subject="Re: [Caml-list] exception handling questions"
  prev="2003/11/64d87a686badb866314b78a4df97dbdc"
  next="2003/11/dcbdf0df5b9bfa06412b452ceddd6cb8"
  prev-in-thread="2003/11/d7efe1f2dbb96b5ef8ce381536426ee8"
  next-in-thread="2003/11/dcbdf0df5b9bfa06412b452ceddd6cb8"
  prev-thread="2003/11/44db0eff4143861e0eb19c3d61393362"
  next-thread="2003/11/4d47045d2b8c12d333c06969e3119ff7"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] exception handling questions">
<msg 
  url="2003/11/272973bb60ea7c7353e7e93caaaffba9"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-11-06T08:39:14"
  subject="[Caml-list] exception handling questions">
<msg 
  url="2003/11/d7efe1f2dbb96b5ef8ce381536426ee8"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-11-06T09:02:04"
  subject="Re: [Caml-list] exception handling questions">
<msg 
  url="2003/11/ff72925752fe0498aceed8943c28dec1"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-11-06T09:50:36"
  subject="Re: [Caml-list] exception handling questions">
<msg 
  url="2003/11/dcbdf0df5b9bfa06412b452ceddd6cb8"
  from="Richard Jones &lt;rich@a...&gt;"
  author="Richard Jones"
  date="2003-11-06T09:56:36"
  subject="Re: [Caml-list] exception handling questions">
</msg>
<msg 
  url="2004/01/19784847825baa3b3e64028239d76cd6"
  from="Eric Stokes &lt;eric.stokes@c...&gt;"
  author="Eric Stokes"
  date="2004-01-31T01:08:32"
  subject="Re: [Caml-list] exception handling questions">
<msg 
  url="2004/01/b272cacdc23759c3ad90fc81c71cc6eb"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2004-01-31T01:53:10"
  subject="Re: [Caml-list] exception handling questions">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/11/64d87a686badb866314b78a4df97dbdc"
  from="Oleg Trott &lt;oleg_trott@c...&gt;"
  author="Oleg Trott"
  date="2003-11-06T09:47:19"
  subject="Re: [Caml-list] exception handling questions">
<msg 
  url="2003/11/05c914606ca067da3fbb8aad946f99c1"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-11-06T10:39:34"
  subject="Re: [Caml-list] exception handling questions">
</msg>
</msg>
</msg>
</thread>

<contents>

On Nov 6, 2003, at 1:02, Richard Jones wrote:

&gt;&gt; 	One thing that really seems to be missing from exception handling is
&gt;&gt; the ability to print a stack trace from an exception.  I realize
&gt;&gt; there's a flag on the ocamlrun to print stacks for uncaught 
&gt;&gt; exceptions,
&gt;&gt; but that's not exactly what I'm looking for.  I'd like to be able to
&gt;&gt; catch and exception, log it, and continue.
&gt;&gt;
&gt;&gt; 	Similarly, is there a way to print an exception at least like the
&gt;&gt; toplevel does?  I can catch any type of exception with the appropriate
&gt;&gt; pattern, but I don't see how I can report it without expecting it.
&gt;
&gt; And while we're at it, printing out a full stack trace with function
&gt; names and parameters.

	Yes, that would be nice, but I'm trying to not ask for too much.  :)  
As it is, I've got a function that can fail when processing large 
amounts of data and it's OK to lose one as long as I know why.  Right 
now, the only way to know why is to rethrow:

let should_process fn =
     try
         (ends_with fn ".") &amp;&amp; (is_new_enough fn) &amp;&amp; (not (is_gzip fn))
     with x -&gt;
         print_endline("Unknown error determining whether to process " ^ 
fn);
         raise x
;;

	Example output:

Unknown error determining whether to process /tmp/x/passwd.
Fatal error: exception Sys_error("/tmp/x/passwd.: Permission denied")

	I'd be plenty happy to print out that message and continue, but in the 
meantime, I've gotta have it abort.

-- 
Dustin Sallings

-------------------
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

</contents>

</message>

