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>nn/Result.h</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>Class that 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 nn::Result result = nn::uds::CTR::EjectClient(); 76 if(result.IsFailure() ) 77 { 78 if( result == nn::uds::ResultNotInitialized() ) 79 { 80 // Not initialized. 81 } 82 else if( result == nn::uds::ResultInvalidState() ) 83 { 84 // Request cannot be executed in the current system state. 85 } 86 else if( result == nn::uds::ResultWirelessOff() ) 87 { 88 // Wireless OFF mode. 89 } 90 else 91 { 92 // Some other error has occurred. 93 } 94 } 95 </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> It is possible system updates could 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 matching result values without 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 will 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> 96 <a name="enum" id="enum"> 97<h2>Enumerated Types</h2> 98 <div class="section"> 99 <table class="members"> 100 <tr> 101 <td width="100"> </td> 102 <th> 103<a href="../../nn/Result/Level.html"><CODE>Level</CODE></a> 104 </th> 105<td>Enumerated type that indicates the severity of errors. (Do not use this type for error handling.)</td> 106 </tr> 107 <tr> 108 <td width="100"> </td> 109 <th> 110<a href="../../nn/Result/Summary.html"><CODE>Summary</CODE></a> 111 </th> 112<td>Enumerated type that provides a brief description of the error. (Do not use this type for error handling.)</td> 113 </tr> 114 <tr> 115 <td width="100"> </td> 116 <th> 117<a href="../../nn/Result/Module.html"><CODE>Module</CODE></a> 118 </th> 119<td>Enumerated type that indicates the modules in which errors occurred. (Do not use this type for error handling.)</td> 120 </tr> 121 <tr> 122 <td width="100"> </td> 123 <th> 124<a href="../../nn/Result/Description.html"><CODE>Description</CODE></a> 125 </th> 126<td>Enumerated type that describes the error in detail. (Do not use this type for error handling.)</td> 127 </tr> </table> 128 </div> 129 </a> <a name="function" id="function"> 130<h2>Member Functions</h2> 131 <div class="section"> 132 <table class="members"> 133 <tr> 134<th class="category" colspan="3">Determination</th> 135 </tr> 136 <tr> 137 <td width="100"> </td> 138 <th> 139<a href="../../nn/Result/IsFailure.html"><CODE>IsFailure</CODE></a> 140 </th> 141<td>Returns <CODE>true</CODE> if the operation failed, or <CODE>false</CODE> if it succeeded.</td> 142 </tr> 143 <tr> 144 <td width="100"> </td> 145 <th> 146<a href="../../nn/Result/IsSuccess.html"><CODE>IsSuccess</CODE></a> 147 </th> 148<td>Returns <CODE>true</CODE> if the operation succeeded, or <CODE>false</CODE> if it failed.</td> 149 </tr> 150 <tr> 151 <td width="100"> </td> 152 <th> 153<a href="../../nn/Result/operator==.html"><CODE>operator ==</CODE></a> 154 </th> 155<td>Tests for equality.</td> 156 </tr> 157 <tr> 158 <td width="100"> </td> 159 <th> 160<a href="../../nn/Result/operator!=.html"><CODE>operator !=</CODE></a> 161 </th> 162<td>Tests for inequality.</td> 163 </tr> 164 <tr> 165<th class="category" colspan="3">Development Support</th> 166 </tr> 167 <tr> 168 <td width="100"> </td> 169 <th> 170<a href="../../nn/Result/GetPrintableBits.html"><CODE>GetPrintableBits</CODE></a> 171 </th> 172<td>Converts a <a href="../../nn/Result/Overview.html"><CODE>Result</CODE></a> into a 32-bit array.</td> 173 </tr> </table> 174 </div> 175 </a> 176<h2>Revision History</h2> 177 <div class="section"> 178 <dl class="history"> 179 <dt>2010/11/10</dt> 180<dd>Added description of error handling. 181 </dd> 182 <dt>2010/10/27</dt> 183<dd>Added description of result value handling. 184 </dd> 185 <dt>2010/01/07</dt> 186<dd>Initial version.<br /> 187 </dd> 188 </dl> 189 </div> 190 <hr><p>CONFIDENTIAL</p></body> 191</html> 192