1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2<html xml:lang="en-US" lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
3  <head>
4    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5    <meta http-equiv="Content-Style-Type" content="text/css" />
6    <link rel="stylesheet" href="../../css/manpage.css" type="text/css" />
7    <style type="text/css"><!--
8      span.static_style
9      {
10        font-size			: 8pt;
11        color				: white;
12        font-weight			: bold;
13        background			: #44f;
14        border-left			: solid 1px #aaf;
15        border-top			: solid 1px #aaf;
16        border-right		: solid 1px #00c;
17        border-bottom		: solid 1px #00c;
18        padding-left		: 2px;
19        padding-right		: 2px;
20      }
21      span.virtual_style
22      {
23        font-size			 : 8pt;
24        color				 : white;
25        font-weight			: bold;
26        background			: #0a0;
27        border-left			: solid 1px #0f0;
28        border-top			: solid 1px #0f0;
29        border-right		: solid 1px #060;
30        border-bottom		: solid 1px #060;
31        padding-left		: 2px;
32        padding-right		: 2px;
33      }
34      span.protected_style
35      {
36        font-size			 : 8pt;
37        color				 : white;
38        font-weight			: bold;
39        background			: #444;
40        border-left			: solid 1px #ccc;
41        border-top			: solid 1px #ccc;
42        border-right		: solid 1px #222;
43        border-bottom		: solid 1px #222;
44        padding-left		: 2px;
45        padding-right		: 2px;
46      }
47        --></style>
48<title>nn::Result</title>
49  </head>
50  <body>
51<h1><CODE><a href="../../nn/Overview.html">nn</a>::Result</CODE> Class</h1>
52    <div class="section">
53<b>Header file: </b><CODE>nn/Result.h</CODE></div>
54<h2>Syntax</h2>
55    <div class="section">
56      <pre class="definition">class Result</pre>
57    </div>
58<h2>Description</h2>
59    <div class="section">
60<p>Indicates the result of an operation.</p><p>
61The SDK interface will return an instance of the <CODE>nn:Result</CODE> class when it is possible to return an error.
62    </p><p>
63For the handling of the Result returned by the different libraries, see the manuals for the respective libraries and APIs. We will give a general description of Result handling here.
64</p><h3> The Meaning of Values Held by Result </h3><p>
65The 32 bits of Result are divided into four sections: LEVEL, SUMMARY, MODULE, and DESCRIPTION.
66    </p><p>
67The internal values of Result are used when debugging to determine the cause of an error.
68    </p><p>
69LEVEL indicates the error processing policy. See <CODE><a href="../../nn/Result/Level.html">nn::Result::Level</a></CODE> for the meaning of the values.
70    </p><p>
71SUMMARY indicates a summary of the error and MODULE indicates the module where error occurred. DESCRIPTION indicates the details of the error.
72    </p><p>
73The application in principle does not branch processing on individual values such as those in DESCRIPTION. Instead it processes errors by comparing the overall 32-bit value. Each library defines the 32-bit Result values that the application needs to process.
74</p><h3> Error Handling Example</h3><p> The following gives an example of error handling using the <a href="../../nn/uds/Overview.html"><CODE>nn::uds</CODE></a> library.</p><pre><code>
75
76    nn::Result result = nn::uds::CTR::EjectClient();
77
78    if( result.IsFailure() )
79    {
80        if( result == nn::uds::ResultNotInitialized() )
81        {
82            // Not initialized.
83        }
84        else if( result == nn::uds::ResultInvalidState() )
85        {
86            // Request cannot be executed in the current system state.
87        }
88        else if( result == nn::uds::ResultWirelessOff() )
89        {
90            // Wireless-disabled mode.
91        }
92        else
93        {
94            // Some other error has occurred.
95        }
96    }
97
98    </code></pre><p> As shown above, first determine from the result if the operation succeeded or failed, and if it failed, match against the results defined by the libraries to identify the error details.</p><p> Take note of the following points.</p><h4> Identifying the Error Type When Processing Has Failed</h4><p> System updates might define additional result values that were not defined when an application was developed. In such cases, you can call the <a href="../../nn/Result/IsSuccess.html"><CODE>nn::Result::IsSuccess</CODE></a> and <a href="../../nn/Result/IsFailure.html"><CODE>nn::Result::IsFailure</CODE></a> functions to determine if a process succeeded or failed.</p><p> Nintendo recommends not just using matching result values without also checking for success, as this entails the risk of falsely determining success in cases of unexpected errors.</p><h4> Explicitly Specifying Namespaces</h4><p> Some result codes are defined with the same names but different values in different libraries. Always specify the namespace explicitly so that your application does not mishandle unexpected errors.</p><h4> <CODE>fs</CODE> Library Handling</h4><p> The <CODE>fs</CODE> library includes a very large number of error types. Due to the risk that the above matching approach might fail to identify an error, <CODE>fs</CODE> library errors are handled in special way. See the <a href="../../nn/fs/Overview.html"><CODE>nn::fs</CODE></a> library reference materials for details.</p></div>
99    <a name="enum" id="enum">
100<h2>Enumerated Types</h2>
101      <div class="section">
102        <table class="members">
103          <tr>
104            <td width="100"> </td>
105            <th>
106<a href="../../nn/Result/Level.html"><CODE>Level</CODE></a>
107            </th>
108<td>Enumerated type that indicates the severity of errors. (Do not use this type for error handling.)</td>
109          </tr>
110          <tr>
111            <td width="100"> </td>
112            <th>
113<a href="../../nn/Result/Summary.html"><CODE>Summary</CODE></a>
114            </th>
115<td>Enumerated type that provides a brief description of the error. (Do not use this type for error handling.)</td>
116          </tr>
117          <tr>
118            <td width="100"> </td>
119            <th>
120<a href="../../nn/Result/Module.html"><CODE>Module</CODE></a>
121            </th>
122<td>Enumerated type that indicates the modules in which errors occurred. (Do not use this type for error handling.)</td>
123          </tr>
124          <tr>
125            <td width="100"> </td>
126            <th>
127<a href="../../nn/Result/Description.html"><CODE>Description</CODE></a>
128            </th>
129<td>Enumerated type that describes the error in detail. (Do not use this type for error handling.)</td>
130          </tr> </table>
131      </div>
132    </a> <a name="function" id="function">
133<h2>Member Functions</h2>
134      <div class="section">
135        <table class="members">
136          <tr>
137<th class="category" colspan="3">Determination</th>
138          </tr>
139          <tr>
140            <td width="100">  </td>
141            <th>
142<a href="../../nn/Result/IsFailure.html"><CODE>IsFailure</CODE></a>
143            </th>
144<td>Returns <CODE>true</CODE> if the operation failed, or <CODE>false</CODE> if it succeeded.</td>
145          </tr>
146          <tr>
147            <td width="100">  </td>
148            <th>
149<a href="../../nn/Result/IsSuccess.html"><CODE>IsSuccess</CODE></a>
150            </th>
151<td>Returns <CODE>true</CODE> if the operation succeeded or <CODE>false</CODE> if it failed.</td>
152          </tr>
153          <tr>
154            <td width="100">  </td>
155            <th>
156<a href="../../nn/Result/operator==.html"><CODE>operator ==</CODE></a>
157            </th>
158<td>Tests for equality.</td>
159          </tr>
160          <tr>
161            <td width="100">  </td>
162            <th>
163<a href="../../nn/Result/operator!=.html"><CODE>operator !=</CODE></a>
164            </th>
165<td>Tests for inequality.</td>
166          </tr>
167          <tr>
168<th class="category" colspan="3">Development Support</th>
169          </tr>
170          <tr>
171            <td width="100">  </td>
172            <th>
173<a href="../../nn/Result/GetPrintableBits.html"><CODE>GetPrintableBits</CODE></a>
174            </th>
175<td>Converts a <a href="../../nn/Result/Overview.html"><CODE>Result</CODE></a> into a 32-bit array.</td>
176          </tr> </table>
177      </div>
178    </a>
179<h2>Revision History</h2>
180    <div class="section">
181      <dl class="history">
182        <dt>2010/11/10</dt>
183<dd>Added description of error handling.
184        </dd>
185        <dt>2010/10/27</dt>
186<dd>Added description of result value handling.
187        </dd>
188        <dt>2010/01/07</dt>
189<dd>Initial version.<br />
190        </dd>
191      </dl>
192    </div>
193  <hr><p>CONFIDENTIAL</p></body>
194</html>
195