<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Clojure Q&amp;A - Recent questions tagged ex-info</title>
<link>https://ask.clojure.org/index.php/tag/ex-info</link>
<description></description>
<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>
</channel>
</rss>