<!-- 
RSS generated by JIRA (4.4#649-r158309) at Sun May 19 01:44:26 CDT 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://dev.clojure.org/jira/si/jira.issueviews:issue-xml/CLJ-733/CLJ-733.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Clojure JIRA</title>
    <link>http://dev.clojure.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>4.4</version>
        <build-number>649</build-number>
        <build-date>25-07-2011</build-date>
    </build-info>

<item>
            <title>[CLJ-733] Data Conveying Exception</title>
                <link>http://dev.clojure.org/jira/browse/CLJ-733</link>
                <project id="10010" key="CLJ">Clojure</project>
                        <description>&lt;p&gt;Problem: need to convey diagnostic information in an exception, and Java exceptions are poor for this because they don&apos;t have any place to put data. Having many apps write their own exceptions is unnecessary code bloat, and sometimes has compilation implications.&lt;/p&gt;

&lt;p&gt;Choices made:&lt;/p&gt;

&lt;ul&gt;
	&lt;li&gt;Naming it &lt;tt&gt;ExceptionInfo&lt;/tt&gt;. Needs to tell the user that it carries data, without suggesting that there was a problem with data.
	&lt;ul&gt;
		&lt;li&gt;think we have to include Exception in the name, esp. for interop consumers.&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;Class of data member. IPersistentMap&lt;/li&gt;
	&lt;li&gt;Class of map input. IPersistentMap&lt;/li&gt;
	&lt;li&gt;Do not want to build anything to support conditional logic. (Use bindings for this).&lt;/li&gt;
	&lt;li&gt;Base class. RuntimeException is consistent with a dynamic language (don&apos;t want to impose checked exceptions).&lt;/li&gt;
	&lt;li&gt;print with data just after msg on first line&lt;/li&gt;
	&lt;li&gt;equality by identity (pretty much dictated by having exception as base class)&lt;/li&gt;
	&lt;li&gt;ex-info factory function&lt;/li&gt;
	&lt;li&gt;ex-data fn to get the data out&lt;/li&gt;
	&lt;li&gt;data and msg arguments required&lt;/li&gt;
	&lt;li&gt;data argument comes second
	&lt;ul&gt;
		&lt;li&gt;matches Java expectation of msg first, cause last&lt;/li&gt;
		&lt;li&gt;matches print order&lt;/li&gt;
	&lt;/ul&gt;
	&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
            <key id="14346">CLJ-733</key>
            <summary>Data Conveying Exception</summary>
                <type id="4" iconUrl="http://dev.clojure.org/jira/images/icons/improvement.gif">Enhancement</type>
                                <priority id="4" iconUrl="http://dev.clojure.org/jira/images/icons/priority_minor.gif">Minor</priority>
                    <status id="6" iconUrl="http://dev.clojure.org/jira/images/icons/status_closed.gif">Closed</status>
                    <resolution id="1">Completed</resolution>
                                <assignee username="stu">Stuart Halloway</assignee>
                                <reporter username="stu">Stuart Halloway</reporter>
                        <labels>
                    </labels>
                <created>Fri, 28 Jan 2011 13:59:41 -0600</created>
                <updated>Fri, 9 Dec 2011 10:01:00 -0600</updated>
                    <resolved>Fri, 9 Dec 2011 10:01:00 -0600</resolved>
                                            <fixVersion>Approved Backlog</fixVersion>
                                        <due></due>
                    <votes>0</votes>
                        <watches>0</watches>
                        <comments>
                    <comment id="26196" author="alan@thinkrelevance.com" created="Fri, 28 Jan 2011 14:47:28 -0600"  >&lt;p&gt;Looks good; Stu&apos;s patch was missing a forward declaration to print-defrecord. 0733-data-conveying-exception-2.patch adds one, and all tests pass.&lt;/p&gt;</comment>
                    <comment id="26209" author="richhickey" created="Mon, 31 Jan 2011 12:42:58 -0600"  >&lt;p&gt;Looks like is-a to me. Why is exception a map?&lt;/p&gt;

&lt;p&gt;Also, bad practice to merge non-namespace-qualified keys with something you don&apos;t originate - should have ns. Actually, why merge at all? Why not let higher-level exception reporting handle cause and message?&lt;/p&gt;

&lt;p&gt;Is there a convention for nesting these, merging data?&lt;/p&gt;</comment>
                    <comment id="26376" author="hiredman" created="Tue, 19 Apr 2011 15:41:46 -0500"  >&lt;p&gt;type checks for :type in metadata, might be nice if that worked on DCE&apos;s, maybe they should support metadata&lt;/p&gt;</comment>
                    <comment id="26976" author="stu" created="Fri, 14 Oct 2011 12:52:32 -0500"  >&lt;p&gt;Latest patch per discussion on IRC &lt;a href=&quot;http://clojure-log.n01se.net/#11:12b&quot;&gt;http://clojure-log.n01se.net/#11:12b&lt;/a&gt; . Note that I had to touch string representation in three places (Java, main, and repl). I think main is only used for repl anyway, so a future cleanup could have main and repl share printing code.&lt;/p&gt;</comment>
                    <comment id="26979" author="richhickey" created="Fri, 14 Oct 2011 13:34:10 -0500"  >&lt;p&gt;Ctor arg order is a question. &lt;/p&gt;

&lt;p&gt;Also, do we want to encourage making an exception w/o a message?&lt;/p&gt;

&lt;p&gt;I think it should have been ex-data, in my last line on IRC, not ex-info&lt;/p&gt;

&lt;p&gt;Will we have a fn to make these rather than encode the type via ctor call everywhere? Maybe that should be called ex-info. Same fn could be useful in cljs&lt;/p&gt;</comment>
                    <comment id="26980" author="richhickey" created="Fri, 14 Oct 2011 13:51:47 -0500"  >&lt;p&gt;Also the description no longer describes the approach&lt;/p&gt;</comment>
                    <comment id="26997" author="stu" created="Sun, 16 Oct 2011 06:06:09 -0500"  >&lt;p&gt;Been back and forth on argument order, but I think msg/data/cause is best.&lt;/p&gt;</comment>
                    <comment id="26999" author="richhickey" created="Sun, 16 Oct 2011 06:32:57 -0500"  >&lt;p&gt;Only issue I think is whether you are going to enforce a map (and not nil) be passed. Currently you don&apos;t, making your doc string for ex-data wrong - it returns .getData of ExceptionInfo objects, which may be nil. If we enforce non-nil map on the way in, then ex-data works as documented and people can catch the exception and branch on ex-data. That seems most useful.&lt;/p&gt;</comment>
                    <comment id="27000" author="richhickey" created="Sun, 16 Oct 2011 06:40:56 -0500"  >&lt;p&gt;Also please mark as alpha, subject to change.&lt;/p&gt;</comment>
                    <comment id="27078" author="alan@thinkrelevance.com" created="Fri, 21 Oct 2011 10:21:02 -0500"  >&lt;p&gt;Attached &lt;tt&gt;0733-with-map-check.patch&lt;/tt&gt;. Same as &lt;tt&gt;0733-with-ex-data-and-ex-info.patch&lt;/tt&gt; but added Alpha docstring and map check to &lt;tt&gt;ex-data&lt;/tt&gt; per Rich&apos;s latest comment.&lt;/p&gt;</comment>
                    <comment id="27079" author="richhickey" created="Fri, 21 Oct 2011 14:15:46 -0500"  >&lt;p&gt;Thanks. The nil check should probably go in the ExceptionInfo ctor, just to have the same enforcement should they be created from Java.&lt;/p&gt;</comment>
                    <comment id="27391" author="stuart.sierra" created="Fri, 2 Dec 2011 09:20:17 -0600"  >&lt;p&gt;I think this line in &lt;tt&gt;clojure.repl/pst&lt;/tt&gt;,&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;(when-let [info (ex-data e)] (str &lt;span class=&quot;code-quote&quot;&gt;&quot; &quot;&lt;/span&gt; info))&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;should be using &lt;tt&gt;pr-str&lt;/tt&gt; instead of &lt;tt&gt;str&lt;/tt&gt;, although &lt;tt&gt;str&lt;/tt&gt; on a map already quotes string keys/values, so maybe it&apos;s good enough.&lt;/p&gt;</comment>
                    <comment id="27392" author="stuart.sierra" created="Fri, 2 Dec 2011 09:21:02 -0600"  >&lt;p&gt;Setting to &apos;Incomplete&apos; pending response to 2 previous comments.&lt;/p&gt;</comment>
                    <comment id="27394" author="stu" created="Fri, 2 Dec 2011 10:07:00 -0600"  >&lt;p&gt;The dec 2 edition does the arg check in the constructor and uses pr-str, addressing the last two comments raised.&lt;/p&gt;</comment>
                    <comment id="27395" author="stu" created="Fri, 2 Dec 2011 10:32:27 -0600"  >&lt;p&gt;The dec 2 edition does the arg check in the constructor and uses pr-str, addressing the last two comments raised.&lt;/p&gt;</comment>
                    <comment id="27412" author="stuart.sierra" created="Sat, 3 Dec 2011 12:06:58 -0600"  >&lt;p&gt;Screened &amp;amp; moved to Approved Backlog.&lt;/p&gt;</comment>
                    <comment id="27419" author="hugoduncan" created="Mon, 5 Dec 2011 16:53:53 -0600"  >&lt;p&gt;ex-info and ex-data seem rather terse names to me (exception-info and exception-data would be clearer, imho).  Clojure seems to have a mixture of abbreviated names and full names, but it was my vague impression that most of the abbreviations stemmed from traditional lisp or java usage.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10096" name="0733-data-conveying-exception-2.patch" size="3799" author="alan@thinkrelevance.com" created="Fri, 28 Jan 2011 14:47:28 -0600" />
                    <attachment id="10095" name="0733-data-conveying-exception.patch" size="3781" author="stu" created="Fri, 28 Jan 2011 14:14:50 -0600" />
                    <attachment id="10729" name="0733-dec-2-edition.patch" size="3727" author="stu" created="Fri, 2 Dec 2011 10:07:00 -0600" />
                    <attachment id="10393" name="0733-ExceptionInfo.patch" size="3916" author="stu" created="Fri, 14 Oct 2011 12:52:32 -0500" />
                    <attachment id="10403" name="0733-with-ex-data-and-ex-info.patch" size="4079" author="stu" created="Sun, 16 Oct 2011 06:06:09 -0500" />
                    <attachment id="10493" name="0733-with-map-check.patch" size="3768" author="alan@thinkrelevance.com" created="Fri, 21 Oct 2011 10:21:02 -0500" />
                </attachments>
            <subtasks>
        </subtasks>
                <customfields>
                                <customfield id="customfield_10002" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Approval</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10007">Ok</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                    <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-global-rank">
                <customfieldname>Global Rank</customfieldname>
                <customfieldvalues>
                    
                </customfieldvalues>
            </customfield>
                                            <customfield id="customfield_10000" key="com.atlassian.jira.plugin.system.customfieldtypes:select">
                <customfieldname>Patch</customfieldname>
                <customfieldvalues>
                        <customfieldvalue key="10002">Code and Test</customfieldvalue>

                </customfieldvalues>
            </customfield>
                                                                                        </customfields>
    </item>
</channel>
</rss>