Re: exceptions

David MacQueen <[email protected]>
Newsgroups gmane.comp.lang.sml.smlnj
Message-ID <[email protected]>
Yes, this is straightforward, and is a common idiom.  You write a  
handler
with a variable pattern and the exception being handled is bound to that
variable and can be reraised as follows:

       <expr>
      handle x => (cleanup code; raise x)

If your cleanup code needs to know what exception is being handled,
it can just do a case on x:

      <expr>
     handle x =>
        ((case x
               of  Foo => cleanup for Foo
                 | Bar(y) => cleanup for Bar
                 | _ => generic cleanup);
          raise x)

Dave MacQueen

On Aug 23, 2006, at 3:03 PM, fredcsunoedu wrote:

>
> Complete newbie so please let me know if i'm in the wrong place.
>
> is there any way to raise in a "handle" expression the same  
> exception that
> got you there?
> that is, i want to do something like
>
> someExpression handle _ => (cleanup(); raise theSameException)
>
> i don't see a way to bind an identifier to the exception being  
> handled.
>
> thanks.
> -- 
> View this message in context: http://www.nabble.com/exceptions- 
> tf2154559.html#a5951682
> Sent from the SML/NJ forum at Nabble.com.
>
>
> ---------------------------------------------------------------------- 
> ---
> Using Tomcat but need to do more? Need to support web services,  
> security?
> Get stuff done quickly with pre-integrated technology to make your  
> job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache  
> Geronimo
> http://sel.as-us.falkag.net/sel? 
> cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Smlnj-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/smlnj-list
>


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.