2011/1/24 Laurent PETIT <laurent.pe...@gmail.com>: > Yes, you're right Shantanu. > > apache commons io and spring framework, to name 2 things I know for > sure, are doing what you say: they swallow any exception that could be > thrown within the finally block, for the reasons you mention.
for the record, references: apache commons i/o: http://commons.apache.org/io/api-release/org/apache/commons/io/IOUtils.html#closeQuietly(java.io.Closeable) > > Of course, with-open allowing to do several binding, the > try/swallow-catch would have to be repeated for each nesting, IMHO. > > Cheers, > > -- > Laurent > > 2011/1/24 Shantanu Kumar <kumar.shant...@gmail.com>: >> >> >> On Jan 25, 2:07 am, dysinger <t...@dysinger.net> wrote: >>> (try (with-open [x y] ... ) >>> (catch Exception)) ;; <- catches any exception from with-open macro >>> >>> I don't think you are correct. >> >> Maybe this is subjective, but I am rarely interested in knowing what >> exception does .close() throw - I would like it ignored. Let me >> explain. Catching 'Exception' over with-open does not solve things, >> for example: >> 1. If the try block returns a value, and .close() raises an >> IOException - that breaks my expectation because I am interested in >> the try block, not .close(). >> 2. If the try block raises exception 'A' and .close() raises exception >> B - that changes semantics for me because (a) I might have, for >> example, setup transaction-strategy based on the types of exception >> thrown, (b) the exception 'A' is lost and I never come to know about >> it. >> >> Regards, >> Shantanu >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with your >> first post. >> To unsubscribe from this group, send email to >> clojure+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en