<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 22:01:26 UTC 2024

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 append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CXX-1110] Add REQUIRE_THROWS_AS_WITH_CODE test macro</title>
                <link>https://jira.mongodb.org/browse/CXX-1110</link>
                <project id="11980" key="CXX">C++ Driver</project>
                    <description>&lt;p&gt;The REQUIRE_THROWS_AS macro from the Catch testing framework allows tests to declare the type of the exception expected to be thrown in an expression.  However, no mechanism exists for introspecting the error code associated with the exception thrown.  Adding a macro such as REQUIRE_THROWS_AS_WITH_CODE would allow for easy creation of tests that fully verify the correctness of the exception thrown.&lt;/p&gt;</description>
                <environment></environment>
        <key id="328507">CXX-1110</key>
            <summary>Add REQUIRE_THROWS_AS_WITH_CODE test macro</summary>
                <type id="3" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14718&amp;avatarType=issuetype">Task</type>
                                            <priority id="3" iconUrl="https://jira.mongodb.org/images/icons/priorities/major.svg">Major - P3</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="rassi">J Rassi</reporter>
                        <labels>
                            <label>error-handling</label>
                    </labels>
                <created>Tue, 1 Nov 2016 18:44:53 +0000</created>
                <updated>Fri, 30 Jun 2023 21:11:28 +0000</updated>
                                                                            <component>Testing</component>
                                        <votes>0</votes>
                                    <watches>3</watches>
                                                                                                                <comments>
                            <comment id="1506553" author="rassi@10gen.com" created="Wed, 22 Feb 2017 22:01:56 +0000"  >&lt;p&gt;Fair point.&lt;/p&gt;

&lt;p&gt;Added &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-834&quot; title=&quot;Return local mongoc errors and server errors in different error spaces&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-834&quot;&gt;CXX-834&lt;/a&gt; as a dependency, kicked out to &quot;Future API change release&quot;.&lt;/p&gt;</comment>
                            <comment id="1506547" author="david.golden" created="Wed, 22 Feb 2017 21:58:33 +0000"  >&lt;p&gt;I agree with the proposal to kick it out.&lt;/p&gt;

&lt;p&gt;Side note regarding #1: I&apos;m OK leaving the public API unspecified, even if our tests have server-version-specific expectations.  I think the benefit of falsifiable tests outweighs the cost of increased fragility.&lt;/p&gt;</comment>
                            <comment id="1499119" author="rassi@10gen.com" created="Wed, 15 Feb 2017 01:27:09 +0000"  >&lt;p&gt;I originally filed this ticket after discussion with &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=david.golden&quot; class=&quot;user-hover&quot; rel=&quot;david.golden&quot;&gt;david.golden&lt;/a&gt; regarding a mongocxx::uri test which verified the correctness of the code associated with the error thrown.  The test in question is here: &lt;a href=&quot;https://github.com/mongodb/mongo-cxx-driver/blob/r3.1.1/src/mongocxx/test/uri.cpp#L37-L42&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-cxx-driver/blob/r3.1.1/src/mongocxx/test/uri.cpp#L37-L42&lt;/a&gt;.  Originally I was thinking that, as part of the work for this ticket, we would go ahead and replace all existing uses of REQUIRE_THROWS_AS() with REQUIRE_THROWS_AS_WITH_CODE(), passing in whatever code the API method in question happens to throw today.&lt;/p&gt;

&lt;p&gt;However, I&apos;m now less confident that the approach above is the best approach.  In particular, here are some open questions:&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;Our API documentation (via &lt;tt&gt;@throws&lt;/tt&gt; directives) doesn&apos;t state anything about what the error code will be when an exception is thrown.  If we want to commit to certain error codes, should we be saying so in our API documentation?  Also, does it make sense to commit to particular error codes that are generated from the server (e.g. DuplicateKey) or from libmongoc (e.g. MONGOC_ERROR_PROTOCOL_BAD_WIRE_VERSION), considering that users can use mongocxx with a range of versions of libmongoc and a range of versions of the server?  Especially before we implement &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-834&quot; title=&quot;Return local mongoc errors and server errors in different error spaces&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-834&quot;&gt;CXX-834&lt;/a&gt;, I&apos;m not sure if it&apos;s a good idea to start committing to particular error codes in our API documentation, or checking them in our tests at all.&lt;/li&gt;
	&lt;li&gt;Should REQUIRE_THROWS_AS_WITH_CODE() take an integral error code, or a std::error_code?  If the former, should it also take an error category?&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;I&apos;m tempted to make this depend on &lt;a href=&quot;https://jira.mongodb.org/browse/CXX-834&quot; title=&quot;Return local mongoc errors and server errors in different error spaces&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CXX-834&quot;&gt;CXX-834&lt;/a&gt;, kick it out to &quot;Future API change release&quot;, and refrain from checking error codes in tests.  &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=david.golden&quot; class=&quot;user-hover&quot; rel=&quot;david.golden&quot;&gt;david.golden&lt;/a&gt;, what do you think?  cc &lt;a href=&quot;https://jira.mongodb.org/secure/ViewProfile.jspa?name=sam.rossi&quot; class=&quot;user-hover&quot; rel=&quot;sam.rossi&quot;&gt;sam.rossi&lt;/a&gt;.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="261469">CXX-834</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>CXX-2377</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr6inj:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="1473">Perl/CXX 2017-01-21</customfieldvalue>
    <customfieldvalue id="1559">Perl/CXX 2017-02-10</customfieldvalue>

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