<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged error</title>
<link>https://ask.clojure.org/index.php/tag/error</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>Typo in the release notes for 1.12.0-alpha6</title>
<link>https://ask.clojure.org/index.php/13672/typo-in-the-release-notes-for-1-12-0-alpha6</link>
<description>&lt;p&gt;This under &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/news/2024/02/08/1-12-alpha6#param-tags&quot;&gt;Array Class Symbols&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Clojure supporst class symbols &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;should be&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Clojure supports class symbols&lt;/p&gt;
&lt;/blockquote&gt;
</description>
<category>Docs</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/13672/typo-in-the-release-notes-for-1-12-0-alpha6</guid>
<pubDate>Fri, 09 Feb 2024 00:51:06 +0000</pubDate>
</item>
<item>
<title>#object[db$getnameonly 0x66908383 db$getnameonly@66908383] 1</title>
<link>https://ask.clojure.org/index.php/12449/object-dbgetnameonly-0x66908383-dbgetnameonly66908383</link>
<description>&lt;p&gt;Hi!&lt;br&gt;
I've been working on a script and I don't understand what this error means.&lt;/p&gt;
&lt;p&gt;My function, takes a number (id) and extract the first element of a list in my vector. &lt;/p&gt;
&lt;p&gt;Details :&lt;/p&gt;
&lt;p&gt;My function :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt; (defn getnameonly [number] 
  (doall (nth (
        (nth 
         (filter #(= number (first %)) customers) 
         0) 
        1) 
       0))
  )
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;where customers is : &lt;br&gt;
(&lt;br&gt;
[1 (John Smith 123 Here Street 456-4567)] &lt;br&gt;
[2 (Sue Jones 43 Rose Court Street 345-7867)] &lt;br&gt;
[3 (Fan Yuhong 165 Happy Lane 345-4533)]&lt;br&gt;
)&lt;/p&gt;
&lt;p&gt;So basically, I want to pull out (return value) &quot;John Smith&quot; if I give 1 to my function.&lt;/p&gt;
&lt;p&gt;The code : &lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(nth (
            (nth 
             (filter #(= number (first %)) customers) 
             0) 
            1) 
           0))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;works fine outside the function. However, when I call :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(println getnameonly 1)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I get :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#object[db$getnameonly 0x66908383 db$getnameonly@66908383] 1
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Any idea why and how to solve this issue?&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12449/object-dbgetnameonly-0x66908383-dbgetnameonly66908383</guid>
<pubDate>Fri, 09 Dec 2022 06:35:16 +0000</pubDate>
</item>
<item>
<title>improve syntax errors on tagged-literals</title>
<link>https://ask.clojure.org/index.php/12256/improve-syntax-errors-on-tagged-literals</link>
<description>&lt;p&gt;When we write a symbol in the UUID literal, the reported error message is wrong&lt;/p&gt;
&lt;p&gt;(as of 1.11.1)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;clojure -M -e '#uuid id'
Execution error (AssertionError) at clojure.main/main (main.java:40).
Assert failed: (string? form)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is wrong because&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;It is not an execution error. Should be read or syntax error.&lt;/li&gt;
&lt;li&gt;It does not include any ex-data: &lt;a rel=&quot;nofollow&quot; href=&quot;https://clojure.org/reference/repl_and_main#_error_printing&quot;&gt;https://clojure.org/reference/repl_and_main#_error_printing&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It should be something like this&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Reader error (AssertionError) at clojure.uuid/default-uuid-reader (uuid.clj:12).
Assert failed: (string? form)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A second step improvement could be add spec support to data-literals, as macros do.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Syntax error reading #uuid id at (REPL:1)
id - failed: string? at: [:form]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;From #clojure-dev slack channel&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Alex: You don’t need anything special there - just an instrumented spec on the data reader fn&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;After run&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(s/fdef clojure.uuid/default-uuid-reader :args (s/cat :form string?))
(clojure.spec.test.alpha/instrument `clojure.uuid/default-uuid-reader)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The message turns into&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Syntax error reading source at (REPL:2:1).
Call to #'clojure.uuid/default-uuid-reader did not conform to spec.
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is a way better message.&lt;/p&gt;
&lt;p&gt;Also, it includes a &lt;code&gt;#:clojure.error{:phase :read-source}&lt;/code&gt; in ex-data.&lt;br&gt;
So the fix could be just add a spec to &lt;code&gt;clojure.uuid/default-uuid-reader&lt;/code&gt;&lt;/p&gt;
</description>
<category>Syntax and reader</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12256/improve-syntax-errors-on-tagged-literals</guid>
<pubDate>Wed, 28 Sep 2022 13:24:40 +0000</pubDate>
</item>
<item>
<title>Why i get &quot;No suitable driver found for jdbc:://127.0.0.1/&quot; ?</title>
<link>https://ask.clojure.org/index.php/12247/why-i-get-no-suitable-driver-found-for-jdbc-127-0-0-1</link>
<description>&lt;p&gt;Java version :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;openjdk 18.0.2-ea 2022-07-19
OpenJDK Runtime Environment (build 18.0.2-ea+9-Ubuntu-222.04)
OpenJDK 64-Bit Server VM (build 18.0.2-ea+9-Ubuntu-222.04, mixed mode, sharing)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;but when i start the nREPL in my text editor, it's says :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;Starting nREPL server...
/usr/lib/jvm/java-11-openjdk-amd64/bin/java ...
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Dependencies :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;:dependencies [[org.clojure/clojure &quot;1.11.1&quot;]
               [com.github.seancorfield/next.jdbc &quot;1.3.834&quot;]
               [org.postgresql/postgresql &quot;42.5.0&quot;]
               [com.layerware/hugsql &quot;0.5.3&quot;]]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;code :&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(def db
    {:classname &quot;org.postgresql.Driver&quot;
     :subprotocol &quot;postgresql&quot;
     :subname &quot;reporting&quot;
     :user &quot;admin&quot;
     :password &quot;admin&quot;})

(defn add-user-transaction [users]
  (jdbc/with-transaction [t-conn db]
                         (if-not (find-user t-conn {:id (:id users)})
                           (add-user! t-conn users))))
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Everything works normal with that configuration, but only when i evaluate&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(add-user-transaction {:id &quot;cheryl&quot;
                   :pass &quot;Cheryl&quot;})
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt; the error appears.&lt;/p&gt;
&lt;p&gt;It's asked in &lt;a rel=&quot;nofollow&quot; href=&quot;https://stackoverflow.com/questions/73521391/clojure-execution-error-sqlexception-at-java-sql-drivermanager-getconnection&quot;&gt;Clojure: Execution error (SQLException) at java.sql.DriverManager/getConnection (DriverManager.java:702)&lt;/a&gt; and already have answered, but the only answer in there is using &lt;code&gt;:deps&lt;/code&gt; or &lt;code&gt;deps.edn&lt;/code&gt; (as far i know, this is Maven repository), so how about leiningen? Or did i miss something about leiningen and Maven?&lt;br&gt;
And i even restarting my pc, text editor, and nREPL but nothing change.&lt;/p&gt;
</description>
<category>Errors</category>
<guid isPermaLink="true">https://ask.clojure.org/index.php/12247/why-i-get-no-suitable-driver-found-for-jdbc-127-0-0-1</guid>
<pubDate>Mon, 26 Sep 2022 21:45:00 +0000</pubDate>
</item>
</channel>
</rss>