<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged exceptions</title>
<link>https://ask.clojure.org/index.php/tag/exceptions</link>
<description></description>
<item>
<title>&quot;Nested&quot; vs &quot;lateral&quot; exception causes</title>
<link>https://ask.clojure.org/index.php/15031/nested-vs-lateral-exception-causes</link>
<description>&lt;p&gt;Currently, &lt;code&gt;clojure.core/ex-info&lt;/code&gt; must take a &lt;code&gt;msg&lt;/code&gt; and data &lt;code&gt;map&lt;/code&gt;, and may take a &lt;code&gt;cause&lt;/code&gt;, which must be another &lt;code&gt;Throwable&lt;/code&gt;, which may have its own &lt;code&gt;cause&lt;/code&gt;, etc. etc..&lt;/p&gt;
&lt;p&gt;This supports the case of &quot;nested&quot; exceptions quite well, e.g. in the case of compilation exceptions being caused by macroexpansion exceptions, potentially with their own cause, and works well for fail-on-first-problem situations.&lt;/p&gt;
&lt;p&gt;There's also the situation of &quot;lateral&quot; exceptions, e.g. in the case of test runners or static analysers, which is not supported. In this case, if we take &lt;code&gt;lazytest&lt;/code&gt; as a concrete example, the test runner throws an exception if any of the test cases it runs throws an exception, but the overall cause of the overall exception, conceptually, is &lt;em&gt;all&lt;/em&gt; the individual exceptions.&lt;/p&gt;
&lt;p&gt;Currently, the only to do this is to make some bespoke thing in the data &lt;code&gt;map&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I propose changing &lt;code&gt;clojure.core/ex-info&lt;/code&gt; to take &lt;code&gt;[msg map &amp;amp; causes]&lt;/code&gt;, which would be a non-breaking change (or, while we're at it, make the &lt;code&gt;map&lt;/code&gt; arg optional as well and default it to &lt;code&gt;{}&lt;/code&gt;, but that's a separate topic).&lt;/p&gt;
&lt;p&gt;That leaves the question of how to handle &lt;code&gt;ex-cause&lt;/code&gt;. To my understanding, to change it to return the cause or the list of causes, would maybe be a breaking change for general exception handling libraries or something, but would not imo pose any significant problem. Alternatively, we might have &lt;code&gt;ex-causes&lt;/code&gt; to always return a list, and change &lt;code&gt;ex-cause&lt;/code&gt; to &lt;code&gt;(comp first ex-causes)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Any thoughts? I don't trust myself to spearhead a PR alone on this but I'd love to contribute, certainly the pure-clojure side of things seems straightforward enough (and I'd love to patch this into &lt;code&gt;lazytest&lt;/code&gt;, but that's again a different topic).&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/15031/nested-vs-lateral-exception-causes</guid>
<pubDate>Sun, 05 Apr 2026 14:18:26 +0000</pubDate>
</item>
<item>
<title>Skip stacktrace creation in ExceptionInfo</title>
<link>https://ask.clojure.org/index.php/14634/skip-stacktrace-creation-in-exceptioninfo</link>
<description>&lt;p&gt;Many libraries and applications use exceptions as control flow or data collection, which allows for handling complex situations with more consistent and legible code. Some libraries use custom throwables (&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/IGJoshua/farolero&quot;&gt;IGJoshua/farolero&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/NoahTheDuke/lazytest&quot;&gt;NoahTheDuke/lazytest&lt;/a&gt;) and some use ExceptionInfos (&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/scgilardi/slingshot/&quot;&gt;scgilardi/slingshot&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/fmnoise/flow&quot;&gt;fmnoise/flow&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/pangloss/pure-conditioning&quot;&gt;pangloss/pure-conditioning&lt;/a&gt;, &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/exoscale/ex&quot;&gt;exoscale/ex&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;One of the reasons that libraries reach for custom throwables is because they want to skip creation of a stack trace (which isn't used and would be thrown away immediately). Stack traces in Java are already fairly expensive to create, and then the filtering work done in &lt;code&gt;ExceptionInfo&lt;/code&gt; greatly increases that expense, making them much slower than needed. (There's an Ask about this but I can't find it.) This performance cost pressures developers to use custom throwables if their code will ever be used in a &quot;hot path&quot;, which harms portability and ease of development. (I want to write Clojure, not Java, and I want it to be usable in Clojurescript and Babashka and whatever other dialects might arise.)&lt;/p&gt;
&lt;p&gt;I know that there's a rejected Jira ticket (&lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.atlassian.net/browse/CLJ-2423&quot;&gt;CLJ-2423&lt;/a&gt;) for supporting the &quot;enableSuppression&quot; flag, but in light of these use-cases, I'd like to bring it up again.&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/14634/skip-stacktrace-creation-in-exceptioninfo</guid>
<pubDate>Thu, 17 Jul 2025 14:46:52 +0000</pubDate>
</item>
<item>
<title>Cannot invoke &quot;clojure.lang.Var.isBound()&quot; because &quot;clojure.lang.Compiler.LOADER&quot; is null, potential bug?</title>
<link>https://ask.clojure.org/index.php/13819/cannot-clojure-isbound-because-clojure-compiler-potential</link>
<description>&lt;p&gt;As per &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojurians.slack.com/archives/C03S1KBA2/p1713446287942589&quot;&gt;discussion&lt;/a&gt; on slack I'm posting here the findings regarding clojure.lang.Compiler.LOADER being null during the analysis phase of GraalVM native-image run.&lt;/p&gt;
&lt;p&gt;The full reproduction can be found &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/FieryCod/graalvm-repro&quot;&gt;here&lt;/a&gt; and the link to issue on Oracle GraalVM side &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/oracle/graal/issues/8801&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What is this issue about?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Native Image cannot be produced and throws an error during analysis phase when Clojure 1.11.2 (although the previous version of Clojure might be also affected) is used and reflection entries for java.lang.UUID and clojure.lang.Keyword are present in &lt;code&gt;reflectionconfig.json&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;I can't however reproduce the error prior to Clojure 1.9.0. For more information please kindly take a look into a repro.&lt;/p&gt;
</description>
<category>Compiler</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13819/cannot-clojure-isbound-because-clojure-compiler-potential</guid>
<pubDate>Thu, 18 Apr 2024 16:11:35 +0000</pubDate>
</item>
<item>
<title>Wrong line number reported for exceptions thrown by code generated by destructuring</title>
<link>https://ask.clojure.org/index.php/13605/number-reported-exceptions-thrown-generated-destructuring</link>
<description>&lt;p&gt;Put anywhere in &lt;code&gt;bad_line_number.clj&lt;/code&gt;, run with &lt;code&gt;clj -J-Dclojure.main.report=stderr -Sdeps '{:paths [&quot;.&quot;]}' -M -m bad-line-number&lt;/code&gt; from the same dir.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(ns bad-line-number)

(defn returns-a-tuple []
  [{1 2} :wrapped])

(defn should-also-return-a-tuple-but-doesnt [data]
  {data :unwrapped})

(defn -main []
  (let [[a fmt] (returns-a-tuple)
        data
        (try
          (should-also-return-a-tuple-but-doesnt a)
          (catch Throwable _
            (println &quot;Unable to create a map&quot;)
            [3 4]))

        [x y]
        (case fmt
          :wrapped data
          :unwrapped [data nil])]
    [x y]))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Running that code results in &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;{:clojure.main/message
 &quot;Execution error (UnsupportedOperationException) at bad-line-number/-main (bad_line_number.clj:10).\nnth not supported on this type: PersistentArrayMap\n&quot;,
 :clojure.main/triage
 {:clojure.error/class java.lang.UnsupportedOperationException,
  :clojure.error/line 10,
  :clojure.error/cause
  &quot;nth not supported on this type: PersistentArrayMap&quot;,
  :clojure.error/symbol bad-line-number/-main,
  :clojure.error/source &quot;bad_line_number.clj&quot;,
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type java.lang.UnsupportedOperationException,
    :message &quot;nth not supported on this type: PersistentArrayMap&quot;,
    :at [clojure.lang.RT nthFrom &quot;RT.java&quot; 992]}],
  :trace
  [[clojure.lang.RT nthFrom &quot;RT.java&quot; 992]
   [clojure.lang.RT nth &quot;RT.java&quot; 940]
   [bad_line_number$_main invokeStatic &quot;bad_line_number.clj&quot; 10]
   [bad_line_number$_main invoke &quot;bad_line_number.clj&quot; 9]
   [clojure.lang.AFn applyToHelper &quot;AFn.java&quot; 152]
   [clojure.lang.AFn applyTo &quot;AFn.java&quot; 144]
   [clojure.lang.Var applyTo &quot;Var.java&quot; 705]
   [clojure.core$apply invokeStatic &quot;core.clj&quot; 667]
   [clojure.main$main_opt invokeStatic &quot;main.clj&quot; 514]
   [clojure.main$main_opt invoke &quot;main.clj&quot; 510]
   [clojure.main$main invokeStatic &quot;main.clj&quot; 664]
   [clojure.main$main doInvoke &quot;main.clj&quot; 616]
   [clojure.lang.RestFn applyTo &quot;RestFn.java&quot; 137]
   [clojure.lang.Var applyTo &quot;Var.java&quot; 705]
   [clojure.main main &quot;main.java&quot; 40]],
  :cause &quot;nth not supported on this type: PersistentArrayMap&quot;}}

Execution error (UnsupportedOperationException) at bad-line-number/-main (bad_line_number.clj:10).
nth not supported on this type: PersistentArrayMap
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As you can see, it refers to line 10, which has &lt;code&gt;(let [[a fmt] (returns-a-tuple)&lt;/code&gt;, so naturally the first line of thinking is &quot;&lt;code&gt;returns-a-tuple&lt;/code&gt; somehow returns a map, and that's what I need to investigate&quot;.&lt;br&gt;
Just spent a few hours chasing that goose when it's actually &lt;code&gt;should-also-return-a-tuple-but-doesnt&lt;/code&gt; that's to blame.&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13605/number-reported-exceptions-thrown-generated-destructuring</guid>
<pubDate>Sat, 06 Jan 2024 10:56:33 +0000</pubDate>
</item>
<item>
<title>Add type hints to `ex-info`</title>
<link>https://ask.clojure.org/index.php/13399/add-type-hints-to-ex-info</link>
<description>&lt;p&gt;Sometimes I need to interact with the base exception information on an ExceptionInfo (such as &lt;code&gt;.setStackTrace&lt;/code&gt;). The core function &lt;code&gt;ex-info&lt;/code&gt; doesn't type hint either arity, so to avoid reflection warnings, I must specify &lt;code&gt;^ExceptionInfo&lt;/code&gt; when using the results of the call:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(let [old-ex (Exception. &quot;asdf&quot;)
      new-ex (ex-info &quot;example&quot; {})]
  (doto  ^ExceptionInfo new-ex (.setStackTrace (.getStackTrace old-ex))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Adding type hints to &lt;code&gt;ex-info&lt;/code&gt; would neatly solve this for all such uses (including the uses in Clojure core, &lt;code&gt;ex-data&lt;/code&gt; etc).&lt;/p&gt;
&lt;p&gt;I can create a patch if there's interest.&lt;/p&gt;
</description>
<category>Metadata</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13399/add-type-hints-to-ex-info</guid>
<pubDate>Tue, 24 Oct 2023 14:01:21 +0000</pubDate>
</item>
<item>
<title>How can tools better detect errors coming from non-existing methods/fields?</title>
<link>https://ask.clojure.org/index.php/13339/tools-better-detect-errors-coming-existing-methods-fields</link>
<description>&lt;p&gt;&lt;code&gt;(.a &quot;&quot;)&lt;/code&gt;, rightfully, throws an IllegalArgumentException without a &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/repl_and_main#_at_repl&quot;&gt;:phase&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;One can consider, however, that this IllegalArgumentException is &quot;compiler-like&quot;, while it doesn't seem primarily distinguishable of other IllegalArgumentExceptions that may be thrown in more &quot;runtime-like&quot; situations.&lt;/p&gt;
&lt;p&gt;My problem is that, as a tool maker, without such a distinction, all IllegalArgumentExceptions will be given the same treatment, while users would want a more concise treatment (e.g. no stacktraces shown) for compiler-like ones.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Is there a recommended way to inspect runtime exceptions for determining if they represent something that, from the user point of view, represents &quot;code that is invalid to begin with&quot;?&lt;ul&gt;
&lt;li&gt;(this is an informal term to describe runtime exceptions that are compiler-like)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Has it been considered to make this easier by e.g. attaching a &lt;code&gt;:cause&lt;/code&gt; (or &lt;code&gt;:phase&lt;/code&gt;, &lt;code&gt;:ex-data&lt;/code&gt;, something) when the Clojure compiler/runtime can reliably do so?&lt;/li&gt;
&lt;/ul&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13339/tools-better-detect-errors-coming-existing-methods-fields</guid>
<pubDate>Thu, 28 Sep 2023 09:43:19 +0000</pubDate>
</item>
<item>
<title>Interest in beginner-friendly variant of (pst)?</title>
<link>https://ask.clojure.org/index.php/13044/interest-in-beginner-friendly-variant-of-pst</link>
<description>&lt;p&gt;Another State of Clojure survey and &quot;error messages&quot; is still the number one priority for improvement.&lt;/p&gt;
&lt;p&gt;A discussion on Slack led to a number of specific pain points for beginners around exceptions and error messages. The one I'd like to focus on here is to provide a beginner-friendly alternative to &lt;code&gt;(pst)&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Currently, &lt;code&gt;(pst)&lt;/code&gt; makes a reasonable attempt at demunging names, eliminating &quot;noise&quot;, and shrinking the stack trace some -- but it still leaves a lot to be desired for &lt;em&gt;beginners&lt;/em&gt; who struggle to understand certain exceptions and have difficulty navigating (Java-style) stack traces, especially compared to some other languages that make a big effort to provide user-friendly error messages and stack traces.&lt;/p&gt;
&lt;p&gt;An example from Slack was:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn f [i]
  (fn [j]
    (/ j i)))

(run! #(% 1) (map f (range 3)))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The exception printed in the REPL is fine but &lt;code&gt;(pst)&lt;/code&gt; shows:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;user=&amp;gt; (pst)
ArithmeticException Divide by zero
        clojure.lang.Numbers.divide (Numbers.java:190)
        user/f/fn--16571 (NO_SOURCE_FILE:3)
        user/eval16576/fn--16577 (NO_SOURCE_FILE:1)
        clojure.core/run!/fn--8906 (core.clj:7849)
...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The elided part mentions &lt;code&gt;clojure.lang.ArrayChunk.reduce&lt;/code&gt; and then has multiple references to &lt;code&gt;clojure.core.protocols&lt;/code&gt; stuff (and doesn't go deep enough by default to show the original call to &lt;code&gt;clojure.core/run!&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;I think there's an opportunity here for a new &lt;code&gt;clojure.repl/explain&lt;/code&gt; function, taking the same arguments as &lt;code&gt;pst&lt;/code&gt;, that provides both a more detailed explanation of the failure and further reduces the noise in the stack trace that &lt;code&gt;pst&lt;/code&gt; currently displays.&lt;/p&gt;
&lt;p&gt;Ideally, this could be implemented with some basic cleanup in core but with some dynamic hooks that allow other tooling to &quot;install&quot; additional expansion and/or cleanup so that the community can provide libraries and functionality that further improve this aspect of the beginner experience.&lt;/p&gt;
&lt;p&gt;A dynamic hook into &lt;code&gt;ex-str&lt;/code&gt;, for example, would allow community-provided tooling to massage the exception message shown (both for the original REPL input and for both &lt;code&gt;pst&lt;/code&gt; and &lt;code&gt;explain&lt;/code&gt;) so that messages that beginners struggle with, such as &lt;code&gt;class &amp;lt;whatever&amp;gt; cannot be cast to clojure.lang.IFn...&lt;/code&gt; could be rewritten into beginner-friendly language (&lt;code&gt;Expected a function - found a &amp;lt;whatever&amp;gt;&lt;/code&gt;).&lt;/p&gt;
&lt;p&gt;Similar dynamic hooks to filter stack frames, and to &quot;print&quot; them to strings, would allow much more friendly output for beginners.&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13044/interest-in-beginner-friendly-variant-of-pst</guid>
<pubDate>Sat, 01 Jul 2023 19:19:33 +0000</pubDate>
</item>
<item>
<title>Vector comparisons raise &quot;clojure.lang.PersistentVector cannot be cast to java.lang.Number&quot; exception</title>
<link>https://ask.clojure.org/index.php/12479/vector-comparisons-clojure-persistentvector-cannot-exception</link>
<description>&lt;p&gt;Hi, when I try to compare certain vectors, I get the above-mentioned error message. I tried in Clojure 1.10.3 and babashka v1.0.168.&lt;br&gt;
These are some of the offending vectors:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(compare [[1] [2 3 4]], [[1] 4])
 ;=&amp;gt; Execution error (ClassCastException) at user/eval1 (REPL:1). 
 ;class java.lang.Long cannot be cast to class clojure.lang.IPersistentVector (java.lang.Long is in module java.base of loader 'bootstrap'; clojure.lang.IPersistentVector is in unnamed module of loader 'app')

(compare [[[1 4 []] [6 2] 6 7 6] [[[10 4]] [10] [[3 5 1 9] 3 1 [7 5] 8] 2] [1 [2 [0 3] [2 10 2] 2] [[2 9 7 8 0] [6 0] 10] 9] [[[8 5 8 3]] 2 [2 3 [7 8]]] [0]]
         [[[[3] 4 4] 10 5 2 []] [7 8] [7 7 [[]]] [] [[[4 10 6 7]] [9] [] 3]])
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Is this a bug, or am I just blind as to why this is &lt;em&gt;obviously&lt;/em&gt; expected behavior?&lt;/p&gt;
&lt;p&gt;I came across this while doing one of the Advent of Code programming exercises yesterday. It asks you to compare a number of vectors, see &lt;a rel=&quot;nofollow&quot; href=&quot;https://adventofcode.com/2022/day/13&quot;&gt;https://adventofcode.com/2022/day/13&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I did solve the exercise by implementing my own vector comparator, according to the specifications given in the exercise. I uploaded the source code in case you want it for testing purposes: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/eNotchy/Advent-of-Code-2022/tree/main/Day13&quot;&gt;https://github.com/eNotchy/Advent-of-Code-2022/tree/main/Day13&lt;/a&gt;&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12479/vector-comparisons-clojure-persistentvector-cannot-exception</guid>
<pubDate>Wed, 14 Dec 2022 21:45:25 +0000</pubDate>
</item>
<item>
<title>Throw an error in cljc code</title>
<link>https://ask.clojure.org/index.php/10401/throw-an-error-in-cljc-code</link>
<description>&lt;p&gt;I'm writing a cljc library that needs to throw an error. This is how I tried to do it:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def ErrorType #?(:clj java.lang.Exception
                  :cljc js/Error)

(throw (new ErrorType &quot;message&quot;))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But this code fails with an error saying &quot;couldn't find class ErrorType&quot;. What is the correct way of doing this?&lt;/p&gt;
</description>
<category>ClojureScript</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10401/throw-an-error-in-cljc-code</guid>
<pubDate>Sun, 04 Apr 2021 14:55:01 +0000</pubDate>
</item>
<item>
<title>Support for suppressed exceptions</title>
<link>https://ask.clojure.org/index.php/10384/support-for-suppressed-exceptions</link>
<description>&lt;p&gt;Java 7 try-with-resources makes sure no exceptions are lost in case &lt;code&gt;close&lt;/code&gt; throws while another exception is already bubbling from the block's body. This is done by attaching the latter exception to the former as suppressed. Suppressed exceptions are made visible in &lt;code&gt;printStackTrace&lt;/code&gt; making it easier to diagnose complex problems involving multiple failures.&lt;/p&gt;
&lt;p&gt;It seems &lt;code&gt;with-open&lt;/code&gt; doesn't record suppressed exceptions. &lt;code&gt;close&lt;/code&gt;-ing is handled in the &lt;code&gt;finally&lt;/code&gt; block, and if the stack has been already unwinding any exceptions thrown by &lt;code&gt;close&lt;/code&gt; will override.&lt;/p&gt;
&lt;p&gt;On top of that, &lt;code&gt;clojure.stacktrace&lt;/code&gt; seems to ignore the existence of suppressed exceptions entirely.&lt;/p&gt;
&lt;p&gt;Is there a reason not to support suppressed exceptions? Or is this just a legacy of pre-Java-7 implementation? Would you consider adding the support in?&lt;/p&gt;
&lt;p&gt;Here's one implementation of &lt;code&gt;with-open&lt;/code&gt; supporting suppression: &lt;a rel=&quot;nofollow&quot; href=&quot;https://gist.github.com/mszajna/0ccbdfbd10927ff5d9517aaeb319952a&quot;&gt;https://gist.github.com/mszajna/0ccbdfbd10927ff5d9517aaeb319952a&lt;/a&gt;&lt;br&gt;
It forgoes of the finally block, closing the resource outside the try block in the happy case. In the unhappy case, the catch block does the suppression recording and makes sure the original exception propagates up.&lt;/p&gt;
&lt;p&gt;I can imagine another implementation could make use of piece of state to record original exception and keep the finally block perhaps.&lt;/p&gt;
&lt;p&gt;I don't have a proposal for &lt;code&gt;clojure.stacktrace&lt;/code&gt; at this stage. I'm not sure whether this should be a new function or should the suppressed exceptions be included in &lt;code&gt;print-cause-trace&lt;/code&gt;. On one hand, backward compatibility is nice, on the other, it would be great for existing tooling to take advantage of this improvement.&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10384/support-for-suppressed-exceptions</guid>
<pubDate>Tue, 30 Mar 2021 12:08:05 +0000</pubDate>
</item>
<item>
<title>clojure.lang.ArityException, Wrong number of args (1) passed?</title>
<link>https://ask.clojure.org/index.php/10274/clojure-lang-arityexception-wrong-number-of-args-1-passed</link>
<description>&lt;p&gt;I am learning clojure, it's my 2nd day with the language, and writing some simple functions:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(defn fib_effi
[n]
(cond (= n 0) 0
      (= n 1) 1
     :else ((defn fib_iter [i fibi_n_prev fibi_n]
               (if (= i n) fibi_n
                   (fib_iter (+ i 1) fibi_n (+ fibi_n fibi_n_prev))))
             (fib_iter 1 0 1))))
(fib_effi 3)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I am getting the error message:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Unhandled clojure.lang.ArityException&lt;br&gt;
 Wrong number of args (1) passed to:&lt;br&gt;
 chapters.core/fib-effi/fib-iter--6404&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Is there anything I am missing?&lt;/p&gt;
</description>
<category>Clojure</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/10274/clojure-lang-arityexception-wrong-number-of-args-1-passed</guid>
<pubDate>Tue, 02 Mar 2021 06:50:04 +0000</pubDate>
</item>
<item>
<title>Namespace.java: addAlias exception could be more informative</title>
<link>https://ask.clojure.org/index.php/8705/namespace-java-addalias-exception-could-more-informative</link>
<description>&lt;p&gt;In &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/clojure/clojure/blob/653b8465845a78ef7543e0a250078eea2d56b659/src/jvm/clojure/lang/Namespace.java#L224-L225&quot;&gt;https://github.com/clojure/clojure/blob/653b8465845a78ef7543e0a250078eea2d56b659/src/jvm/clojure/lang/Namespace.java#L224-L225&lt;/a&gt;, the &lt;code&gt;ns&lt;/code&gt; argument is not included in the exception message.&lt;/p&gt;
&lt;p&gt;This hinders debuggabiliity, especially when the &lt;code&gt;.addAlias&lt;/code&gt; call didn't originate from intentful aliasing, but rather, as a result of re-evaluating a namespace (which is the AST-building strategy that tools such as &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/jonase/eastwood&quot;&gt;https://github.com/jonase/eastwood&lt;/a&gt; use).&lt;/p&gt;
&lt;p&gt;Have you considered improving the message?&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/8705/namespace-java-addalias-exception-could-more-informative</guid>
<pubDate>Thu, 10 Oct 2019 15:55:01 +0000</pubDate>
</item>
</channel>
</rss>