Errors on the CTR system can be broadly classified into the following categories:
A fatal error 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.
As 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.
If error display on the system is not possible, just stop the system.
It's possible to recover from the following types of errors.
If 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.
Most SDK interfaces will return an instance of the nn:Result class when it is possible to return an error. For details, see the Result class.
To learn details about the error handling by each library, read the references for those libraries.
When 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.
#include <nn/err.h>
NN_ERR_THROW_FATAL(result);
When a Result type argument is given for this macro, if the result is fatal (LEVEL_FATAL) or one not expected to occur in the final retail product (like LEVEL_USAGE or LEVEL_PERMANENT), the process transitions to the display of the FATAL ERROR screen.
NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result);
When the above macro is used, the FATAL ERROR screen will appear only if the result type is LEVEL_FATAL.
NN_ERR_THROW_FATAL_ALL(result);
When the above macro is used, the FATAL ERROR screen will appear unless the result type is success (LEVEL_SUCCESS). (Only use this macro if it is specified in the recommended error handling sequence for each library.)
The 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.
Using 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.
A 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.
In certain cases such as when the save data is corrupted, the error handling must even include application sequences.
For this reason, the processing methods for errors returned by the system are different from those of the other libraries. For details, see the nn::fs documentation.
NN_ERR_THROW_FATAL_IF_FATAL_ONLY and NN_ERR_THROW_FATAL_ALL, and partially revised other information.CONFIDENTIAL