[CLJ-1293] Portable "catch-all" mechanism Created: 05/Nov/13 Updated: 27/Jan/16
|Patch:||Code and Test|
CLJS ticket/patch: http://dev.clojure.org/jira/browse/CLJS-661
This patch is more permissive than my patch for CLJS: The CLJS patch ensures :default catch blocks occur between non-default catch blocks and finally blocks, if present. This patch just makes (catch :default ...) a synonym for (catch Throwable ...). I wanted to keep the change to the compiler minimum.
Open Question: Catch Throwable (patch v001 does this) or Exception? Alternatively, a more carefully crafted list of "non-fatal" errors. See Scala's NonFatal pattern extractor: http://www.scala-lang.org/api/current/index.html#scala.util.control.NonFatal$
|Comment by Brandon Bloom [ 28/Dec/14 11:33 AM ]|
Noticed this switched from "Minor" to "Critical", so I figured I should mention that I later realized that we might want :default to catch Exception instead of Throwable, so as to avoid catching Error subclasses. Javadocs say: "An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch." If that's what we actually want, I can provide an updated patch.
|Comment by Alex Miller [ 28/Dec/14 2:19 PM ]|
Seems like an open question, might be best just to list it as such in the description.
I don't really expect to reach consensus on the ticket or patch right now, just trying to update priorities and raise visibility for discussion with Rich once we get to 1.8.