On Oct 24, 7:46 am, "Paul Stadig" <[EMAIL PROTECTED]> wrote:
> So the moral of the story (in terms of idiomatic clojure) is to
> declare RuntimeExceptions instead of Exceptions (if you need to
> declare an exception)? Or is there a better way to handle errors?
>
You don't declare exceptions in Clojure. If you mean derive from
RuntimeException, that won't help, as at present most wrapping
contexts just catch any Exception (which will catch RuntimeExceptions)
and throw wrapped in a new RuntimeException. I recommend you try to
use an existing Exception type when possible (there are too many
already), and derive from Exception otherwise.
The real issue is on the handling side. In general, I think unless you
are directly calling something that declares specific exceptions, you
need to catch Exception then see what you've got, including examining
the cause. You should presume that all generic plumbing, i.e. most of
Clojure, might throw Exceptions, sometimes wrapping others.
Rich
--~--~---------~--~----~------------~-------~--~----~
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
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
-~----------~----~----~----~------~----~------~--~---