Clojure doesn't have checked exceptions, but it uses a java compiler trick
called sneaky-throws to rethrow and catch them, so versions past 1.3 don't
wrap them in RuntimeExceptions.

Generally, clojure won't go out of its way to protect you from exceptions
or catch them for you, but it's idiomatic to return nil as an error
condition (clojure.java.io/resource), so you can use it in an 'if'.

My best advice is to just read the code:

spit:
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L6291
IO factories:
https://github.com/clojure/clojure/blob/master/src/clj/clojure/java/io.clj



On Mon, Jul 8, 2013 at 2:17 PM, Marcel Möhring <[email protected]>wrote:

> Hello,
>
> as a Java developer I'm a bit confused about the lack of exceptions.
>
> A minimal example:
>
> (spit "filename" "a String" :encoding "UTF-8")
>
> the corresponding Java code has got 4 possible exceptions:
> UnsupportedEncodingException
> FileNotFoundException
> 2 x IOException (on .write and on .close)
>
>
> Are all of this exception catched internally by Clojure?
> Is there any kind of documentation to see which function throws which
> exception?
>
>
> Marcel
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to [email protected]
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscribe@**googlegroups.com<clojure%[email protected]>
> For more options, visit this group at
> http://groups.google.com/**group/clojure?hl=en<http://groups.google.com/group/clojure?hl=en>
> --- You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to 
> clojure+unsubscribe@**googlegroups.com<clojure%[email protected]>
> .
> For more options, visit 
> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
> .
>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to