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 22 span.virtual_style 23 { 24 font-size : 8pt; 25 color : white; 26 font-weight : bold; 27 background : #0a0; 28 border-left : solid 1px #0f0; 29 border-top : solid 1px #0f0; 30 border-right : solid 1px #060; 31 border-bottom : solid 1px #060; 32 padding-left : 2px; 33 padding-right : 2px; 34 } 35 36 span.protected_style 37 { 38 font-size : 8pt; 39 color : white; 40 font-weight : bold; 41 background : #444; 42 border-left : solid 1px #ccc; 43 border-top : solid 1px #ccc; 44 border-right : solid 1px #222; 45 border-bottom : solid 1px #222; 46 padding-left : 2px; 47 padding-right : 2px; 48 } 49 --></style> 50<title>nn::Result</title> 51 </head> 52 <body> 53<h1><CODE>nn::Result</CODE> Class</h1> 54 <div class="section"> 55<b>Header file: </b>nn/Result.h</div> 56<h2>Syntax</h2> 57 <div class="section"> 58 <pre class="definition">class Result</pre> 59 </div> 60<h2>Description</h2> 61 <div class="section"> 62<p>Class that indicates the result of an operation.</p><p> 63The SDK interface will return an instance of the <CODE>nn:Result</CODE> class when it is possible to return an error. 64 </p><p> 65For 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. 66</p><h3> The Meaning of Values Held by Result </h3><p> 67The 32 bits of Result are divided into four sections: LEVEL, SUMMARY, MODULE, and DESCRIPTION. 68 </p><p> 69The internal values of Result are used at debugging to determine the cause of an error. 70 </p><p> 71LEVEL indicates the error processing policy. See <CODE><a href="../../nn/Result/Level.html">nn::Result::Level</a></CODE> for the meaning of the values. 72 </p><p> 73SUMMARY indicates a summary of the error and MODULE indicates the module where error occurred. DESCRIPTION indicates the details of the error. 74 </p><p> 75The 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. 76 </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> 77 78 nn::Result result = nn::uds::CTR::EjectClient(); 79 80 if( result.IsFailure() ) 81 { 82 if( result == nn::uds::ResultNotInitialized() ) 83 { 84 // Not initialized. 85 } 86 else if( result == nn::uds::ResultInvalidState() ) 87 { 88 // Request cannot be executed in the current system state. 89 } 90 else if( result == nn::uds::ResultWirelessOff() ) 91 { 92 // Wireless OFF mode. 93 } 94 else 95 { 96 // Some other error has occurred. 97 } 98 } 99 100 </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 that a system update leads to 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 may have identical values but different names in multiple libraries. Note that there may be cases where applications cannot handle unexpected errors, and the namespace must be explicitly specified.</p><h4> <CODE>fs</CODE> Library Handling</h4><p> The <CODE>fs</CODE> library includes a very large number of potential error types. Due to the risk that the above matching approach might fail to identify an error, <CODE>fs</CODE> library errors are handled differently. See the <a href="../../nn/fs/Overview.html"><CODE>nn::fs</CODE></a> library reference materials for details.</p></div> 101 <a name="enum" id="enum"> 102<h2>Enumerated Types</h2> 103 <div class="section"> 104 <table class="members"> 105 <tr> 106 <td width="100"> </td> 107 <th> 108<a href="../../nn/Result/Level.html"><CODE>Level</CODE></a> 109 </th> 110<td>Enumerated type that indicates the severity of errors. (Do not use this type for error handling.)</td> 111 </tr> 112 <tr> 113 <td width="100"> </td> 114 <th> 115<a href="../../nn/Result/Summary.html">Summary</a> 116 </th> 117<td>Enumerated type that indicates the summary of an error. (Do not use this type for error handling.)</td> 118 </tr> 119 <tr> 120 <td width="100"> </td> 121 <th> 122<a href="../../nn/Result/Module.html">Module</a> 123 </th> 124<td>Enumerated type that indicates the modules in which errors occurred. (Do not use this type for error handling.)</td> 125 </tr> 126 <tr> 127 <td width="100"> </td> 128 <th> 129<a href="../../nn/Result/Description.html"><CODE>Description</CODE></a> 130 </th> 131<td>Enumerated type representing error descriptions. (Do not use this type for error handling.)</td> 132 </tr> </table> 133 </div> 134 </a> <a name="function" id="function"> 135<h2>Member Functions</h2> 136 <div class="section"> 137 <table class="members"> 138 <tr> 139<th class="category" colspan="3">Determination</th> 140 </tr> 141 <tr> 142 <td width="100"> </td> 143 <th> 144<a href="../../nn/Result/IsFailure.html"><CODE>IsFailure</CODE></a> 145 </th> 146<td>Returns <CODE>true</CODE> if the operation failed, or <CODE>false</CODE> if it succeeded.</td> 147 </tr> 148 <tr> 149 <td width="100"> </td> 150 <th> 151<a href="../../nn/Result/IsSuccess.html"><CODE>IsSuccess</CODE></a> 152 </th> 153<td>Returns <CODE>true</CODE> if the operation succeeded, or <CODE>false</CODE> if it failed.</td> 154 </tr> 155 <tr> 156 <td width="100"> </td> 157 <th> 158<a href="../../nn/Result/operator==.html"><CODE>operator ==</CODE></a> 159 </th> 160<td>Tests for equality.</td> 161 </tr> 162 <tr> 163 <td width="100"> </td> 164 <th> 165<a href="../../nn/Result/operator!=.html"><CODE>operator !=</CODE></a> 166 </th> 167<td>Tests for inequality.</td> 168 </tr> 169 <tr> 170<th class="category" colspan="3">Development support.</th> 171 </tr> 172 <tr> 173 <td width="100"> </td> 174 <th> 175<a href="../../nn/Result/GetPrintableBits.html"><CODE>GetPrintableBits</CODE></a> 176 </th> 177<td>Converts a <a href="../../nn/Result/Overview.html"><CODE>Result</CODE></a> into a 32-bit array.</td> 178 </tr> </table> 179 </div> 180 </a> 181<h2>Revision History</h2> 182 <div class="section"> 183 <dl class="history"> 184 <dt>2010/11/10</dt> 185<dd>Added description of error handling. 186 </dd> 187 <dt>2010/10/27</dt> 188<dd>Added description of result value handling. 189 </dd> 190 <dt>2010/01/07</dt> 191<dd>Initial version.<br /> 192 </dd> 193 </dl> 194 </div> 195 <hr><p>CONFIDENTIAL</p></body> 196</html>