1<?xml version="1.0" encoding="utf-16"?> 2<html xml:lang="en-US" lang="en-US"> 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/page.css" type="text/css" /> 7<title>Error Handling</title> 8</head> 9<body> 10<h1>Error Handling</h1> 11<h2>Overview</h2> 12 <p> 13Errors on the CTR system can be broadly classified into the following categories: 14 </p> 15<h3> Unsustainable Fatal Errors </h3> 16 <p> 17A <I>fatal error</I> is an error due to a hardware bug or other error that should not arise in the retail product. The system cannot recover from such an error and there is no means of error handling. 18 </p> 19 <p> 20As a general rule, when an error of this type arises, the error is not passed over to the application but instead the system stops and FATAL ERROR is displayed on the screen. Users who encounter this error display should check the manual in accordance with the message and, if the problem cannot be resolved, contact User Support as a last resort. 21 </p> 22 <p> 23If error display on the system is not possible, just stop the system. 24 </p> 25<h3> Recoverable Errors </h3> 26 <p> 27It's possible to recover from the following types of errors. 28 </p> 29 30 <ul> 31<li>Incorrect settings</li> 32<li>Communication errors</li> 33<li>File capacity exceeded or insufficient free space</li> 34<li>Corrupted save data </li> 35<li>Software inconsistency (recoverable by reinitializing and other means)</li> 36<li>A fatal error that allows the system to continue to run (such as a broken camera)</li> 37 </ul> 38 39 <p> 40If any of these types of errors are encountered, have the application conduct the pertinent error handling to try to recover, and if necessary use the error display applet to inform the user that an error has occurred. In principle, the application can continue to operate. 41 </p> 42 43<h2> Error Handling </h2> 44 45 <p> 46Most SDK interfaces will return an instance of the <CODE>nn:Result</CODE> class when it is possible to return an error. For details, see the <CODE><a href="../nn/Result/Overview.html">Result</a></CODE> class. 47 </p> 48 49 <p> 50To learn details about the error handling by each library, read the references for those libraries. 51 </p> 52 53<h3> Handling of Fatal Errors </h3> 54 55 <p> 56When a fatal error occurs, the system normally responds internally so there is no need to return an error to the application. That being said, when the same state occurs in the application's processing, you can use the following macro to output the FATAL ERROR screen like that displayed by the system. 57 </p> 58 59 <pre><code> 60 #include <nn/err.h> 61 62 NN_ERR_THROW_FATAL(result); 63 </code></pre> 64 65 <p> 66When a <span class="argument">Result</span> type argument is given for this macro, if the result is fatal (<CODE>LEVEL_FATAL</CODE>) or one not expected to occur in the final retail product (like <CODE>LEVEL_USAGE</CODE> or <CODE>LEVEL_PERMANENT</CODE>), the process transitions to the display of the FATAL ERROR screen. 67 </p> 68 <pre><code> 69 <CODE>NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);</CODE> 70 </code></pre> 71 <p> 72When the above macro is used, the FATAL ERROR screen will appear only if the <SPAN class="argument">result</SPAN> type is <CODE>LEVEL_FATAL</CODE>. 73 </p> 74 <pre><code> 75 NN_ERR_THROW_FATAL_ALL(result); 76 </code></pre> 77 <p> 78When the above macro is used, the FATAL ERROR screen will appear unless the <SPAN class="argument">result</SPAN> type is success (<CODE>LEVEL_SUCCESS</CODE>). (Only use this macro if it is specified in the recommended error handling sequence for each library.)</strong> 79 </p> 80 <p> 81The FATAL ERROR screen shwos a message for end users in the lower screen. On development hardware only, details about the error appear in the upper screen. In either case, the system stops and can no longer be operated other than turning off the system. 82 </p> 83 <p> 84Using these macros from the application is not a problem in and of itself, but be aware that displaying the FATAL ERROR screen in this way can lead users to contact User Support. Avoid using these macros to handle errors that occur normally due to the execution environment or user operations. 85 </p> 86 87<h3> Error Handling Relating to File Operations </h3> 88 89 <p> 90A wide variety of errors can occur and be returned by the system, depending on such factors as the authority to access different media and different files. 91 </p> 92 93 <p> 94In certain cases such as when the save data is corrupted, the error handling must even include application sequences. 95 </p> 96 97 <p> 98For this reason, the processing methods for errors returned by the system are different from those of the other libraries. For details, see the <A href="../nn/fs/Overview.html">nn::fs</A> documentation. 99 </p> 100 101<h2>Revision History</h2> 102 <div class="section"> 103 <dl class="history"> 104 <dt>2011/03/01</dt> 105 <dd>Added descriptions of <CODE>NN_ERR_THROW_FATAL_IF_FATAL_ONLY</CODE> and <CODE>NN_ERR_THROW_FATAL_ALL</CODE>, and partially revised other information.</dd> 106 <dt>2010/10/27</dt> 107 <dd>Initial version.</dd> 108 </dl> 109 </div> 110<hr><p>CONFIDENTIAL</p></body> 111</html> 112